From a47031d4bbebd0e16f70ecf92e8ad037cfa24d6d Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Tue, 26 Oct 2021 18:15:25 -0400 Subject: add themes/hugo-pt2021/layouts/_default/index.xml --- themes/hugo-pt2021/layouts/_default/index.xml | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 themes/hugo-pt2021/layouts/_default/index.xml (limited to 'themes/hugo-pt2021/layouts') diff --git a/themes/hugo-pt2021/layouts/_default/index.xml b/themes/hugo-pt2021/layouts/_default/index.xml new file mode 100644 index 0000000..aaa9fdb --- /dev/null +++ b/themes/hugo-pt2021/layouts/_default/index.xml @@ -0,0 +1,49 @@ +{{/* +index.xml: shamelessly borrowed from the default hugo rss template. + +URL: + https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml + +Changes: +* changed ".Summary | html" to ".Content | htmlEscape" +* changed "Recent content on" to "Recent posts on" +*/}} +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := slice -}} +{{- if or $.IsHome $.IsSection -}} + {{- $pages = where $pctx.RegularPages "Section" "posts" -}} +{{- else -}} + {{- $pages = $pctx.Pages -}} +{{- end -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- 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 posts {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} + Hugo -- gohugo.io{{ with .Site.LanguageCode }} + {{.}}{{end}}{{ 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 .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ .Permalink }} + {{ .Content | htmlEscape }} + + {{ end }} + + -- cgit v1.2.3