From 11845d4a7c1e9299e64974094ef8dbaed195ae30 Mon Sep 17 00:00:00 2001
From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com>
Date: Wed, 31 Dec 2025 19:54:16 +0800
Subject: [PATCH] fix(rss): lastBuildDate and description
align usage with Hugo
https://github.com/gohugoio/hugo/blob/v0.153.4/tpl/tplimpl/embedded/templates/rss.xml
---
layouts/_default/rss.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml
index f5d42854..0967c780 100644
--- a/layouts/_default/rss.xml
+++ b/layouts/_default/rss.xml
@@ -23,7 +23,7 @@
{{ if .Site.Params.footer.showCopyright | default true -}}
{{ with replace .Site.Params.copyright "{ year }" now.Year }}{{.}}{{ else }}© {{ now.Format "2006" }} {{ .Site.Params.Author.name }}{{- end }}
{{- end }}
- {{ if not .Date.IsZero }}{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }}
+ {{ if not .Date.IsZero }}{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }}
{{- with .OutputFormats.Get "RSS" -}}
{{ printf "" .Permalink .MediaType | safeHTML }}
{{- end -}}
@@ -40,7 +40,7 @@
{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}
{{ with .Site.Params.Author.email }}{{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}{{end}}
{{ .Permalink }}
- {{ .Summary | plainify | htmlUnescape | safeHTML }}
+ {{ .Summary | transform.XMLEscape | safeHTML }}
{{ range ( where .Site.RegularPages ".RelPermalink" .RelPermalink | first 1 ) }}
{{- $images := .Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}}