From bf804a08146afba3530671b4a99f31a9f5ae577d Mon Sep 17 00:00:00 2001 From: Caio Lente <7017340+clente@users.noreply.github.com> Date: Tue, 17 Oct 2023 15:41:36 -0300 Subject: Improved RSS template --- layouts/_default/rss.xml | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 layouts/_default/rss.xml (limited to 'layouts/_default/rss.xml') diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml new file mode 100644 index 0000000..c55e7e4 --- /dev/null +++ b/layouts/_default/rss.xml @@ -0,0 +1,42 @@ +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := slice -}} +{{- if $.IsHome -}} +{{- $pages = where $pctx.AllPages "Kind" "page" -}} +{{ else if $.IsSection }} +{{- $pages = $pctx.RegularPages -}} +{{- else -}} +{{- $pages = $pctx.Pages -}} +{{- end -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{{- printf "" | safeHTML }} + + + {{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} + {{ .Permalink }} + Recent content {{ if not .IsHome }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} + Hugo -- gohugo.io + {{ site.Language.LanguageCode }}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{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 }} + + {{ .Title }} + {{ .Permalink }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ with .Params.author }}{{.}}{{ end }} + {{ .Permalink }} + {{ .Summary | plainify }} + {{ `` | safeHTML }} + + {{ end }} + + \ No newline at end of file -- cgit v1.2.3