From e25a7e7eef56dec321d481b2d5f6983be108ec5e Mon Sep 17 00:00:00 2001 From: Ashton Wiersdorf Date: Thu, 17 Aug 2023 22:56:56 -0600 Subject: [PATCH 1/3] Add RSS template; exclude unlisted = true pages --- layouts/_default/rss.xml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 layouts/_default/rss.xml diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml new file mode 100644 index 00000000..1d186dd0 --- /dev/null +++ b/layouts/_default/rss.xml @@ -0,0 +1,40 @@ +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := slice -}} +{{- if or $.IsHome $.IsSection -}} +{{- $pages = $pctx.RegularPages -}} +{{- else -}} +{{- $pages = $pctx.Pages -}} +{{- end -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{{- $pages = (where $pages ".Params.unlisted" "!=" "true") -}} +{{- 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 }} + 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 .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ .Permalink }} + {{ .Summary | html }} + + {{ end }} + + From f7c7be64bca820f2b20eca32c12f779eed7f85da Mon Sep 17 00:00:00 2001 From: Ashton Wiersdorf Date: Thu, 17 Aug 2023 23:01:04 -0600 Subject: [PATCH 2/3] Update README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index be8d7648..1255218e 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,8 @@ And Enable it by setting `BookMenuBundle: /menu` in Site configuration. A simple blog is supported in the section `posts`. A blog is not the primary usecase of this theme, so it has only minimal features. +You can exclude items from the RSS feed by adding `unlisted = true` to the frontmatter. + ## Configuration ### Site Configuration From dc86c92aeaa1d71da67be4aa4cabb9fcb1214b38 Mon Sep 17 00:00:00 2001 From: Ashton Wiersdorf Date: Fri, 18 Aug 2023 00:03:25 -0600 Subject: [PATCH 3/3] Use full content in RSS feed --- layouts/_default/rss.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 1d186dd0..58b7410b 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -33,7 +33,7 @@ {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} {{ .Permalink }} - {{ .Summary | html }} + {{ .Content | html }} {{ end }}