🐛 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
+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 }}