From 6abc13406224f2582e6d70a3b8b431efcbfe0bd8 Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Thu, 25 Nov 2021 23:49:05 +0000 Subject: [PATCH] first attempt at putting images in rss feed --- archetypes/default.md | 2 + layouts/_default/rss.xml | 45 +++++++++++++++++++++++ themes/blackburn/archetypes/default.md | 1 + themes/blackburn/layouts/_default/li.html | 3 +- 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 layouts/_default/rss.xml diff --git a/archetypes/default.md b/archetypes/default.md index 40fa4b6..3827280 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -3,5 +3,7 @@ title: "{{ replace .Name "-" " " | title }}" date: {{ .Date }} tags: [] topics: [] +image: "" +description: "" draft: true --- diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml new file mode 100644 index 0000000..69d96af --- /dev/null +++ b/layouts/_default/rss.xml @@ -0,0 +1,45 @@ +{{- $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 -}} +{{- 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{{ 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 }} + <![CDATA[ +

+ + {{.Content | html }} +

+ ]]> +
+
+ {{ end }} +
+
\ No newline at end of file diff --git a/themes/blackburn/archetypes/default.md b/themes/blackburn/archetypes/default.md index 35f1a6b..f1206c4 100644 --- a/themes/blackburn/archetypes/default.md +++ b/themes/blackburn/archetypes/default.md @@ -4,5 +4,6 @@ date = "{{ .Date }}" draft = true tags = [] topics = [] +image = "" description = "" +++ diff --git a/themes/blackburn/layouts/_default/li.html b/themes/blackburn/layouts/_default/li.html index 6701579..ccf391a 100644 --- a/themes/blackburn/layouts/_default/li.html +++ b/themes/blackburn/layouts/_default/li.html @@ -2,4 +2,5 @@ - - {{ .Title }} + - {{ .Title }} +