]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
tpl: fix incorrect lastBuildDate
authorDaniel Terhorst-North <daniel@dannorth.net>
Mon, 30 Oct 2023 16:56:52 +0000 (16:56 +0000)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 25 Jan 2024 18:46:52 +0000 (19:46 +0100)
Set the `<lastBuildDate>` field to be the most recent Lastmod date
of all the posts in the current selection.

Fixes #11600

tpl/tplimpl/embedded/templates/_default/rss.xml

index 6818d31ec16c82d507081eb3e2afa4365dbec85e..c997be31c4ddedb9f665ed05379bf1e321c0219d 100644 (file)
@@ -53,7 +53,7 @@
     <managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }}
     <webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
     <copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
-    <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
+    <lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
     {{- with .OutputFormats.Get "RSS" }}
     {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
     {{- end }}