Skip to content

Commit

Permalink
✨ Display title at the top of the page
Browse files Browse the repository at this point in the history
  • Loading branch information
Ice-Hazymoon committed Sep 28, 2022
1 parent 421df78 commit 08886ca
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
2 changes: 2 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module:
params:
publicCDN: ""

topTitle: false

announcement:
enabled: false
file: "README.md"
Expand Down
4 changes: 4 additions & 0 deletions exampleSite/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ params:
# CDN URL
publicCDN: ""

# 在网站顶部显示标题和摘要,使用 .Site.Title 和 .Site.Params.Description
# Display title and description at the top of the page, use .Site.Title and .Site.Params.Description
topTitle: false

# 在首页顶部创建一个通知部分
# Create a Announcement section at the top of the home page
announcement:
Expand Down
6 changes: 3 additions & 3 deletions layouts/_default/twitter.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
{{ if $lazyload }}data-{{ end }}srcset="{{- $processImage.Srcset -}}"
{{ if $lazyload }}src="{{- or $processImage.Placeholder $lazyload_image -}}"{{ end }}
{{- with $title -}}alt="{{- . -}}"{{- end -}}
class="w-full border border-x-0 border-solid border-gray-200 object-cover dark:border-darkBorder"
class="w-full border border-x-0 border-solid border-gray-100 object-cover dark:border-darkBorder"
{{ if $imageZoom }}data-zoomable{{ end }}
{{ if $lazyload }}data-lazyload data-lazyload-blur{{ end }}
/>
Expand All @@ -95,7 +95,7 @@
srcset="{{- $processImage.Srcset -}}"
src="{{- print $public_cdn $processImage.Permalink -}}"
{{- with $title -}}alt="{{- . -}}"{{- end -}}
class="w-full border border-x-0 border-solid border-gray-200 object-cover dark:border-darkBorder"
class="w-full border border-x-0 border-solid border-gray-100 object-cover dark:border-darkBorder"
/>
</picture>
</a>
Expand All @@ -109,7 +109,7 @@
{{ if $lazyload }}data-{{ end }}src="{{- $picURL -}}"
{{ if $lazyload }}src="{{- $lazyload_image -}}"{{ end }}
{{- with $title -}}alt="{{- . -}}"{{- end -}}
class="w-full border border-x-0 border-solid border-gray-200 object-cover dark:border-darkBorder"
class="w-full border border-x-0 border-solid border-gray-100 object-cover dark:border-darkBorder"
{{ if $imageZoom }}data-zoomable{{ end }}
{{ if $lazyload }}data-lazyload{{ end }}
/>
Expand Down
10 changes: 5 additions & 5 deletions layouts/partials/data/description.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- Use site subtitle by default -->
{{ $description := .Description }}
{{ if .IsPage }}
{{ $description := or .Description .Site.Params.description }}
{{- if .IsPage -}}
<!-- Use page summary -->
{{ $description = .Summary }}
{{ end }}
{{- $description = .Summary -}}
{{- end -}}

{{ return ($description | plainify)}}
{{- return ($description | plainify) -}}
7 changes: 7 additions & 0 deletions layouts/partials/html/header.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<header class="{{- if .Site.Params.fixedNav -}} fixed z-10 backdrop-blur-md bg-white/80 dark:bg-darkFg mx-auto w-full md:max-w-4xl xl:max-w-4xl 2xl:max-w-4xl {{- else -}} relative {{- end -}}">
{{- if .Site.Params.topTitle -}}
<div class=" text-center py-6 border-b dark:border-darkBorder">
{{- with .Site.Title -}}<div class="text-3xl">{{- . -}}</div>{{- end -}}
{{- with .Site.Params.Description -}}<div class="text-lg mt-4 text-gray-400">{{- . -}}</div>{{- end -}}
</div>
{{- end -}}

{{- $RelPermalink := .RelPermalink -}}
{{- if .Site.Menus.main -}}
<nav id="nav" class="navbar top-0 z-10 flex items-center border-b px-5 py-6 dark:border-darkBorder md:px-10">
Expand Down

0 comments on commit 08886ca

Please sign in to comment.