diff --git a/assets/css/_core/_header.scss b/assets/css/_core/_header.scss index a3086018..4461048f 100644 --- a/assets/css/_core/_header.scss +++ b/assets/css/_core/_header.scss @@ -251,7 +251,6 @@ header { border-radius: $global-border-radius; border: 1px solid $global-border-color; background-color: $header-background-color; - @include z-index(2, 50); @include transition(box-shadow 0.3s ease); [data-theme='dark'] & { diff --git a/layouts/_default/single.md b/layouts/_default/single.md index c8de22d5..89645971 100644 --- a/layouts/_default/single.md +++ b/layouts/_default/single.md @@ -1,9 +1,5 @@ {{- $params := .Scratch.Get "params" -}} -{{- $author := .Site.Author | merge (dict "name" "Anonymous" "link" (echoParam $params "authorlink")) -}} -{{- if isset $params "author" | and (ne $params.author .Site.Author.name) -}} - {{- $author = dict "name" $params.author | merge $author -}} - {{- $author = dict "link" (echoParam $params "authorlink") | merge $author -}} -{{- end -}} +{{- $author := .Scratch.Get "author" -}} # {{ .Title }} {{ if $params.password -}} diff --git a/layouts/partials/init/patch.html b/layouts/partials/init/patch.html index af3f71ec..af15bd5b 100644 --- a/layouts/partials/init/patch.html +++ b/layouts/partials/init/patch.html @@ -1,6 +1,36 @@ {{- /* FixIt theme patches */ -}} {{- $params := .Scratch.Get "params" -}} +{{- /* Author data patch */ -}} +{{- $authorDefault := dict "name" "Anonymous" "link" "" "email" "" "avatar" "" -}} +{{- $author := .Site.Author | merge $authorDefault -}} +{{- $authorPost := dict -}} +{{- $gravatar := .Site.Params.gravatar -}} +{{- if reflect.IsMap $params.author -}} + {{- $authorPost = $params.author -}} +{{- else if isset $params "author" -}} + {{- $authorPost = dict "name" $params.author -}} +{{- end -}} +{{- if isset $authorPost "name" | and (ne $authorPost.name .Site.Author.name) -}} + {{- $author = $authorPost | merge $authorDefault | merge $author -}} +{{- else -}} + {{- with $authorPost.link -}}{{ $author = dict "link" . | merge $author }}{{- end -}} + {{- with $authorPost.email -}}{{ $author = dict "email" . | merge $author }}{{- end -}} + {{- with $authorPost.avatar -}}{{ $author = dict "avatar" . | merge $author }}{{- end -}} +{{- end -}} + +{{- if $gravatar.enable | and $author.email -}} + {{- with $gravatar -}} + {{- $author = dict "avatar" (printf "https://%v/avatar/%v?s=32&d=%v" + (path.Clean .Host | default "www.gravatar.com") + (md5 $author.email) + (.Style | default "")) + | merge $author + -}} + {{- end -}} +{{- end -}} +{{- .Scratch.Set "author" $author -}} + {{- /* Toc data patch */ -}} {{- $toc := $params.toc -}} {{- if eq $toc true -}} diff --git a/layouts/partials/rss/item.html b/layouts/partials/rss/item.html index b9fc01da..5cd22238 100644 --- a/layouts/partials/rss/item.html +++ b/layouts/partials/rss/item.html @@ -1,4 +1,13 @@ -{{- $params := .Page.Params | merge .Site.Params.Page | merge (dict "author" .Site.Author.name) -}} +{{- $params := .Page.Params | merge .Site.Params.Page -}} +{{- $authorName := .Site.Author.name | default (T "single.author") -}} +{{- with .Params.author -}} + {{- if reflect.IsMap . -}} + {{- $authorName = cond (isset . "name") .name $authorName -}} + {{- else -}} + {{- $authorName = . -}} + {{- end -}} +{{- end -}} + {{- .Page.Title -}} @@ -7,11 +16,9 @@ {{- .Page.Permalink -}} </link> <pubDate> - {{- .Page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} + {{- .Page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} </pubDate> - <author> - {{- $params.author | default (T "single.author") -}} - </author> + <author>{{ $authorName }}</author> <guid> {{- .Page.Permalink -}} </guid> diff --git a/layouts/partials/single/post-author.html b/layouts/partials/single/post-author.html index 8e42bcdf..81ac927d 100644 --- a/layouts/partials/single/post-author.html +++ b/layouts/partials/single/post-author.html @@ -1,34 +1,5 @@ {{- $params := .Scratch.Get "params" -}} -{{- $authorDefault := dict "name" "Anonymous" "link" "" "email" "" "avatar" "" -}} -{{- $author := .Site.Author | merge $authorDefault -}} -{{- $authorPost := dict -}} -{{- $gravatar := .Site.Params.gravatar -}} - -{{- if $params.authorAvatar -}} - {{- if reflect.IsMap $params.author -}} - {{- $authorPost = $params.author -}} - {{- else if isset $params "author" -}} - {{- $authorPost = dict "name" $params.author -}} - {{- end -}} - {{- if isset $authorPost "name" | and (ne $authorPost.name .Site.Author.name) -}} - {{- $author = $authorPost | merge $authorDefault | merge $author -}} - {{- else -}} - {{- with $authorPost.link -}}{{- $author = dict "link" . | merge $author -}}{{- end -}} - {{- with $authorPost.email -}}{{- $author = dict "email" . | merge $author -}}{{- end -}} - {{- with $authorPost.avatar -}}{{- $author = dict "avatar" . | merge $author -}}{{- end -}} - {{- end -}} - - {{- if $gravatar.enable | and $author.email -}} - {{- with $gravatar -}} - {{- $author = dict "avatar" (printf "https://%v/avatar/%v?s=32&d=%v" - (path.Clean .Host | default "www.gravatar.com") - (md5 $author.email) - (.Style | default "")) - | merge $author - -}} - {{- end -}} - {{- end -}} -{{- end -}} +{{- $author := .Scratch.Get "author" -}} <span class="post-author"> {{- $content := $author.name -}}