From ede07966fb99952294e6297fd22fd4ad713cc6e9 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Sat, 23 Sep 2023 14:22:03 -0700 Subject: [PATCH] Move vars and logic above content --- layouts/_default/rss.xml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 970ebf03..79e57c02 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -70,6 +70,7 @@ {{ range $subpage := $subpages }} + {{ $author := "" }} {{ $authors := partial "paige/authors.html" . }} {{ $description := .Content }} {{ $guid := "" }} @@ -80,17 +81,14 @@ {{ $link := cond $paramlink .Params.link .Permalink }} - {{ with $authors }} + {{ if $authors }} {{ $primary := index . 0 }} - {{ $author := "" }} {{ if and $primary.name $primary.email }} {{ $author = printf "%s (%s)" $primary.name $primary.email }} {{ else if $primary.email }} {{ $author = $primary.email }} {{ end }} - - {{ $author }} {{ end }} {{ if $description }} @@ -105,8 +103,8 @@ {{ $description = .Description | markdownify}} {{ end }} - {{ with $description }} - {{ printf "" . | safeHTML }} + {{ if and (not $description) (not $title) }} + {{ warnf "layouts/_default/rss.xml: Page %s does not have a title or description" .RelPermalink }} {{ end }} {{ if .Params.id }} @@ -123,6 +121,15 @@ {{ end }} {{ $guids = merge (dict $guid .RelPermalink) $guids }} + + {{ with $author }} + {{ . }} + {{ end }} + + {{ with $description }} + {{ printf "" . | safeHTML }} + {{ end }} + {{ $guid }} {{ with $link }} @@ -136,10 +143,6 @@ {{ with $title }} {{ . }} {{ end }} - - {{ if and (not $description) (not $title) }} - {{ warnf "layouts/_default/rss.xml: Page %s does not have a title or description" .RelPermalink }} - {{ end }} {{ end }}