From 0ed9fe2a8b692481e832cc8ab8f1461fbce5c7ad Mon Sep 17 00:00:00 2001 From: iGor milhit Date: Mon, 26 Aug 2024 08:39:50 +0200 Subject: [PATCH] rss: set pubdate with the last modification date - Sets the publication date to the last modification date if it exists. Co-Authored-by: iGor milhit --- layouts/_default/rss.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index f1f1c2a..7fc2460 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -29,7 +29,11 @@ {{ .Title }} {{ .Permalink }} + {{ if (and (isset .Params "lastmod") (gt (dateFormat "2006-01-02" (.Lastmod)) (dateFormat "2006-01-02" (.PublishDate)))) }} + {{ .Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ else }} {{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ end }} {{ with .Site.Params.author.email }}{{.}}{{ with $.Site.Params.author.name }} ({{.}}){{end}}{{end}} {{ .Permalink }} {{ .Content | html }}