Skip to content

Commit

Permalink
Merge pull request #405 from p0n1/fix-post-author
Browse files Browse the repository at this point in the history
fix: restore per-post author override functionality
  • Loading branch information
xianmin authored Nov 1, 2024
2 parents a1bb1b0 + 761d420 commit 2b2e22d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ <h1 class="post-title">{{ .Title }}</h1>
</article>

<!-- Author Info -->
{{ if and (.Site.Params.author.name | default .Site.Author.name) (.Params.showAuthorInfo | default
{{ if and ( .Params.author | default .Site.Params.author.name | default .Site.Author.name) (.Params.showAuthorInfo | default
.Site.Params.showAuthorInfo) }}
{{ partial "author_info.html" (dict "author" (.Site.Params.author.name | default .Site.Author.name) "context" $) }}
{{ partial "author_info.html" (dict "author" (.Params.author | default .Site.Params.author.name | default .Site.Author.name) "context" $) }}
{{ end }}


Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
<meta name="mobile-web-app-capable" content="yes">

<!-- author & description & keywords -->
{{- if or .Site.Params.author.name .Site.Author.name -}}
{{- $author_id := .Site.Params.author.name | default .Site.Author.name -}}
{{- if or .Params.author .Site.Params.author.name .Site.Author.name -}}
{{- $author_id := .Params.author | default .Site.Params.author.name | default .Site.Author.name -}}
{{- $author := (index ($.Site.Data.authors | default dict) $author_id) -}}
{{- $author_lang := (index ($author | default dict) .Site.Language.Lang) -}}
{{- $author_name := $author_lang.name.display | default $author.name.display | default $author_id -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/post/copyright.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p class="copyright-item">
<span class="item-title">{{ i18n "author" }}</span>
<span class="item-content">
{{- $author_id := .Site.Params.author.name | default .Site.Author.name -}}
{{- $author_id := .Params.author | default .Site.Params.author.name | default .Site.Author.name -}}
{{- $author := (index ($.Site.Data.authors | default dict) $author_id) -}}
{{- $author_lang := (index ($author | default dict) .Site.Language.Lang) -}}
{{- $author_name := $author_lang.name.display | default $author.name.display | default $author_id -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/post/meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{ partial "icons/icon" (dict
"path" "icons/post/author.svg"
) }}
{{- $author_id := .Site.Params.author.name | default .Site.Author.name -}}
{{- $author_id := .Params.author | default .Site.Params.author.name | default .Site.Author.name -}}
{{- $author := (index ($.Site.Data.authors | default dict) $author_id) -}}
{{- $author_lang := (index ($author | default dict) .Site.Language.Lang) -}}
{{- $author_name := $author_lang.name.display | default $author.name.display | default $author_id -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/post/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="post-title">
{{ partial "icons/icon" (dict
"path" "icons/post/author.svg"
) }}
{{- $author_id := .Site.Params.author.name | default .Site.Author.name -}}
{{- $author_id := .Params.author | default .Site.Params.author.name | default .Site.Author.name -}}
{{- $author := (index ($.Site.Data.authors | default dict) $author_id) -}}
{{- $author_lang := (index ($author | default dict) .Site.Language.Lang) -}}
{{- $author_name := $author_lang.name.display | default $author.name.display | default $author_id -}}
Expand Down

0 comments on commit 2b2e22d

Please sign in to comment.