diff options
author | Thedro Neely <thedroneely@gmail.com> | 2020-01-16 20:55:37 -0500 |
---|---|---|
committer | Thedro Neely <thedroneely@gmail.com> | 2020-01-16 20:55:37 -0500 |
commit | 2dc991d62c72be9a3da368f5d9bc2c038c92b604 (patch) | |
tree | 6c9abaa061b247ef4365942fc3b8e1068d7fc908 /generators/hugo/themes/tdro/layouts/_default/rss.xml | |
parent | d5c31c69fea79791f4566a8840a0a36afd8b8396 (diff) | |
download | thedroneely.com-2dc991d62c72be9a3da368f5d9bc2c038c92b604.tar.gz thedroneely.com-2dc991d62c72be9a3da368f5d9bc2c038c92b604.tar.bz2 thedroneely.com-2dc991d62c72be9a3da368f5d9bc2c038c92b604.zip |
app/views/snippets/rss: Cleanup RSS
Hide pages with hidden attribute
Diffstat (limited to 'generators/hugo/themes/tdro/layouts/_default/rss.xml')
-rw-r--r-- | generators/hugo/themes/tdro/layouts/_default/rss.xml | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/generators/hugo/themes/tdro/layouts/_default/rss.xml b/generators/hugo/themes/tdro/layouts/_default/rss.xml index dfaf7f4..2bd93b9 100644 --- a/generators/hugo/themes/tdro/layouts/_default/rss.xml +++ b/generators/hugo/themes/tdro/layouts/_default/rss.xml @@ -1,4 +1,11 @@ -{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }} +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := $pctx.RegularPages -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> @@ -11,17 +18,19 @@ <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} {{ with .OutputFormats.Get "RSS" }} - {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} + {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} {{ end }} - {{ range .Pages }} - <item> - <title>{{ .Title }}</title> - <link>{{ .Permalink }}</link> - <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> - {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} - <guid>{{ .Permalink }}</guid> - <description>{{ .Content | replaceRE `<\?php(.*?\n?)*?\?>` "" | html }}</description> - </item> + {{ range $pages }} + {{ if (ne .Params.hidden true) }} + <item> + <title>{{ .Title }}</title> + <link>{{ .Permalink }}</link> + <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> + {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} + <guid>{{ .Permalink }}</guid> + <description>{{ .Content | replaceRE `<\?php(.*?\n?)*?\?>` "" | html }}</description> + </item> + {{ end }} {{ end }} </channel> </rss> |