From 4b663ca8e357631f8517030081d13f0b9836659c Mon Sep 17 00:00:00 2001 From: Thiago Perrotta Date: Fri, 14 Jan 2022 17:32:48 -0500 Subject: [PATCH] Fall back post author to '.Site.Author.name' when it is not set. '.Site.Author' is a recognized Hugo site variable, c.f. [1]. It's also already used elsewhere within PaperMod, namely in rss.xml. By falling back to this variable users' configs can be simplified, being effectively unnecessary to set the author twice, in .Site.Params.author. [1]: c.f. https://gohugo.io/variables/site/#site-variables-list --- layouts/partials/author.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/partials/author.html b/layouts/partials/author.html index 4582b126..121977b8 100644 --- a/layouts/partials/author.html +++ b/layouts/partials/author.html @@ -1,5 +1,5 @@ -{{- if or .Params.author .Site.Params.author }} -{{- $author := (.Params.author | default .Site.Params.author) }} +{{- if or .Params.author .Site.Params.author .Site.Author.name }} +{{- $author := (.Params.author | default .Site.Params.author | default .Site.Author.name) }} {{- $author_type := (printf "%T" $author) }} {{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }} {{- (delimit $author ", " ) }}