From ff7443b17f597e2307a590c805e39df1d935ebc6 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sat, 4 Nov 2023 15:34:56 +0530 Subject: [PATCH] [PATCH] tpl/tplimpl: Fix deprecation logic in RSS template cherry-pick from https://github.com/gohugoio/hugo/commit/23fcfb7f741a417f53a8ef4997bb68e64631df01 --- layouts/_default/rss.xml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 22b2e6ed..3b28fbf6 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -1,7 +1,11 @@ {{- /* Deprecate site.Author.email in favor of site.Params.author.email */}} {{- $authorEmail := "" }} -{{- with site.Params.author.email }} - {{- $authorEmail = . }} +{{- with site.Params.author }} + {{- if reflect.IsMap . }} + {{- with .email }} + {{- $authorEmail = . }} + {{- end }} + {{- end }} {{- else }} {{- with site.Author.email }} {{- $authorEmail = . }} @@ -11,8 +15,14 @@ {{- /* Deprecate site.Author.name in favor of site.Params.author.name */}} {{- $authorName := "" }} -{{- with site.Params.author.name }} - {{- $authorName = . }} +{{- with site.Params.author }} + {{- if reflect.IsMap . }} + {{- with .name }} + {{- $authorName = . }} + {{- end }} + {{- else }} + {{- $authorName = . }} + {{- end }} {{- else }} {{- with site.Author.name }} {{- $authorName = . }}