From c79a95ffd43688b0f532b1574ce231a0ce8442cd Mon Sep 17 00:00:00 2001 From: Maik de Kruif Date: Thu, 11 Nov 2021 15:24:54 +0100 Subject: [PATCH] Make RSS feed look nicer --- .../layouts/{posts => _default}/rss.xml | 15 ++++++-- themes/maik-blog/layouts/rss.xml | 5 +++ themes/maik-blog/layouts/writeups/rss.xml | 36 ------------------- 3 files changed, 17 insertions(+), 39 deletions(-) rename themes/maik-blog/layouts/{posts => _default}/rss.xml (67%) delete mode 100644 themes/maik-blog/layouts/writeups/rss.xml diff --git a/themes/maik-blog/layouts/posts/rss.xml b/themes/maik-blog/layouts/_default/rss.xml similarity index 67% rename from themes/maik-blog/layouts/posts/rss.xml rename to themes/maik-blog/layouts/_default/rss.xml index fe09a79..ef59394 100644 --- a/themes/maik-blog/layouts/posts/rss.xml +++ b/themes/maik-blog/layouts/_default/rss.xml @@ -1,6 +1,7 @@ - XXX {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} + {{"favicon-32x32.png" | absURL}} {{ .Permalink }} Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} {{- with .Site.LanguageCode }} @@ -23,13 +24,21 @@ {{- end }} {{ range .Pages }} - {{ .Title }} + {{ .Title }}{{ with .Params.Subtitle }} // {{ . }}{{ end }} {{ .Permalink }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ .Date.Format "2006-01-02T15:04:05Z0700" | safeHTML }} + {{- if .GitInfo }} + {{ dateFormat "2006-01-02T15:04:05Z0700" .GitInfo.AuthorDate.Local | safeHTML }} + {{- end }} {{ .Params.author }} {{ .Permalink }} {{ printf `` .Params.description | safeHTML }} - {{ printf `` .Content | safeHTML }} + {{ $content := .Content}} + {{- if .Params.Cover }} + {{- $content = (printf `%s%s` (partial "image.html" (dict "path" .Params.Cover "alt" (.Title | plainify) "class" "post-cover")) $content) }} + {{- end }} + {{ printf `` $content | safeHTML }} {{ end }} diff --git a/themes/maik-blog/layouts/rss.xml b/themes/maik-blog/layouts/rss.xml index 1935f30..ca8f097 100644 --- a/themes/maik-blog/layouts/rss.xml +++ b/themes/maik-blog/layouts/rss.xml @@ -1,6 +1,7 @@ {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} + {{"favicon-32x32.png" | absURL}} {{ .Permalink }} Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} {{- with .Site.LanguageCode }} @@ -26,6 +27,10 @@ {{ .Title }} {{ .Permalink }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ .Date.Format "2006-01-02T15:04:05Z0700" | safeHTML }} + {{- if .GitInfo }} + {{ dateFormat "2006-01-02T15:04:05Z0700" .GitInfo.AuthorDate.Local | safeHTML }} + {{- end }} {{ .Site.Author.name }} {{ .Permalink }} {{ printf `` .Summary | safeHTML }} diff --git a/themes/maik-blog/layouts/writeups/rss.xml b/themes/maik-blog/layouts/writeups/rss.xml deleted file mode 100644 index fe09a79..0000000 --- a/themes/maik-blog/layouts/writeups/rss.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - XXX {{ 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 }} - {{- 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 }} - {{ .Params.author }} - {{ .Permalink }} - {{ printf `` .Params.description | safeHTML }} - {{ printf `` .Content | safeHTML }} - - {{ end }} - -