🐛 Fix: author display error in post and markdown file

This commit is contained in:
Cell
2022-08-14 14:45:13 +08:00
parent 806572a817
commit 87156110a6
3 changed files with 8 additions and 2 deletions
+1
View File
@@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
- :sparkles: Feat: add custom aside template in post page ([#172](https://github.com/hugo-fixit/FixIt/issues/172))
- :bug: Fix: add function doc2unix to unify new lines symbol between Windows and Unix/Mac OS
- :bug: Fix: author display error in post and markdown file
- :wrench: Chore: modify babel config and optimize theme.js compilation and loading
- :wrench: Chore(deps-dev):
- Remove minimist
+6 -1
View File
@@ -1,4 +1,9 @@
{{- $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 -}}
# {{ .Title }}
{{ if $params.password -}}
@@ -9,6 +14,6 @@
---
> {{ T "author"}}: {{ .Site.Author.name }}
> {{ T "author"}}: {{ with $author.link }}[{{ $author.name }}]({{ . }}){{ else }}{{ $author.name }}{{ end }}
> URL: {{ .Permalink }}
{{ if $params.repost.enable | and (hasPrefix $params.repost.url "http") }}> {{ T "repost" }} URL: {{ $params.repost.url }}{{ end }}
+1 -1
View File
@@ -1,6 +1,6 @@
{{- $params := .Scratch.Get "params" -}}
{{- $author := .Site.Author | merge (dict "name" "" "link" (echoParam $params "authorlink") "email" (echoParam $params "authoremail")) -}}
{{- $author := .Site.Author | merge (dict "name" "Anonymous" "link" (echoParam $params "authorlink") "email" (echoParam $params "authoremail")) -}}
{{- $avatar := .Site.Params.home.profile.avatarURL -}}
{{- if isset $params "author" | and (ne $params.author .Site.Author.name) -}}
{{- $author = dict "name" $params.author | merge $author -}}