🐛 Fix: get author name error in seo.html (#288)

This commit is contained in:
Cell
2023-03-03 16:23:15 +08:00
parent 0b5e40e2bf
commit 914f02643e
2 changed files with 11 additions and 4 deletions
File diff suppressed because one or more lines are too long
+10 -3
View File
@@ -70,6 +70,14 @@
{{- /* Page SEO */ -}}
{{- else if .IsPage -}}
{{- $authorName := .Site.Author.name | default (T "single.author") -}}
{{- with .Params.author -}}
{{- if reflect.IsMap . -}}
{{- $authorName = cond (isset . "name") .name $authorName -}}
{{- else -}}
{{- $authorName = . -}}
{{- end -}}
{{- end -}}
<script type="application/ld+json">
{
"@context": "http://schema.org",
@@ -128,8 +136,7 @@
{{- with .Site.Copyright -}}
"license": {{ . | safeHTML }},
{{- end -}}
{{- $postAuthor := cond (reflect.IsMap .Params.author) .Params.author.name .Params.author -}}
{{- $publisher := $postAuthor | default .Site.Author.name | default (T "single.author") | dict "name" -}}
{{- $publisher := $authorName | dict "name" -}}
{{- $publisher = $params.seo.publisher | default dict | merge $publisher -}}
"publisher": {
"@type": "Organization",
@@ -148,7 +155,7 @@
{{- end -}}
{{- end -}}
},
{{- with $postAuthor | default .Site.Author.name | default (T "single.author") -}}
{{- with $authorName -}}
"author": {
"@type": "Person",
"name": {{ . | safeHTML }}