mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
🐛 Fix: add author data patch (#288)
This commit is contained in:
@@ -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'] & {
|
||||
|
||||
@@ -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 -}}
|
||||
|
||||
@@ -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 -}}
|
||||
|
||||
@@ -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 -}}
|
||||
|
||||
<item>
|
||||
<title>
|
||||
{{- .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>
|
||||
|
||||
@@ -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 -}}
|
||||
|
||||
Reference in New Issue
Block a user