From 73484a80d743aa9d17b5338a6f9dcd87f12994b9 Mon Sep 17 00:00:00 2001 From: Wonderfall Date: Sun, 31 Dec 2023 20:09:48 +0100 Subject: [PATCH] refactor rss template --- layouts/_default/rss.xml | 69 +++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index eb888afb..b0e223ad 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -42,42 +42,39 @@ {{- if ge $limit 1 }} {{- $pages = $pages | first $limit }} {{- end }} + {{- printf "" | safeHTML }} - - - {{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ site.Title }}{{ end }} - {{ .Permalink }} - Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ site.Title }} - {{- with site.Params.images }} - - {{ site.Title }} - {{ index . 0 | absURL }} - {{ index . 0 | absURL }} - - {{- end }} - Hugo -- gohugo.io - {{ site.Language.LanguageCode }}{{ with $authorEmail }} - {{.}}{{ with $authorName }} ({{ . }}){{ end }}{{ end }}{{ with $authorEmail }} - {{ . }}{{ with $authorName }} ({{ . }}){{ end }}{{ end }}{{ with site.Copyright }} - {{ . }}{{ end }}{{ if not .Date.IsZero }} - {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} - {{- with .OutputFormats.Get "RSS" }} - {{ printf "" .Permalink .MediaType | safeHTML }} - {{- end }} - {{- range $pages }} + + {{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ site.Title }}{{ end }} + + + Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ site.Title }} + {{ .Permalink }} + Hugo + {{ site.Language.LanguageCode }} + {{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }} + + {{ with $authorName }}{{ . }}{{ end }} + {{ with $authorEmail }}{{ . }}{{ end }} + + {{ with site.Copyright }}{{ . }}{{ end }} + + {{- range $pages }} {{- if and (ne .Layout `search`) (ne .Layout `archives`) }} - - {{ .Title }} - {{ .Permalink }} - {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{- with $authorEmail }}{{ . }}{{ with $authorName }} ({{ . }}){{ end }}{{ end }} - {{ .Permalink }} - {{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}} - {{- if site.Params.ShowFullTextinRSS }} - {{ (printf "" .Content) | safeHTML }} - {{- end }} - + + {{ .Title }} + + {{ .Permalink }} + {{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }} + {{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }} + {{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}} + {{- if site.Params.ShowFullTextinRSS }} + {{ .Content | html }} + {{- end }} + {{- end }} - {{- end }} - - + {{- end }} + + + +