Make RSS feed look nicer

alternate-navbar
Maik de Kruif 3 years ago
parent 956eede4d8
commit c79a95ffd4
Signed by: maik
GPG Key ID: 44A55AD1F0673FA6
  1. 15
      themes/maik-blog/layouts/_default/rss.xml
  2. 5
      themes/maik-blog/layouts/rss.xml
  3. 36
      themes/maik-blog/layouts/writeups/rss.xml

@ -1,6 +1,7 @@
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0"> <rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
<channel> <channel>
<title>XXX {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<icon>{{"favicon-32x32.png" | absURL}}</icon>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
{{- with .Site.LanguageCode }} {{- with .Site.LanguageCode }}
@ -23,13 +24,21 @@
{{- end }} {{- end }}
{{ range .Pages }} {{ range .Pages }}
<item> <item>
<title>{{ .Title }}</title> <title>{{ .Title }}{{ with .Params.Subtitle }} // {{ . }}{{ end }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<published>{{ .Date.Format "2006-01-02T15:04:05Z0700" | safeHTML }}</published>
{{- if .GitInfo }}
<updated>{{ dateFormat "2006-01-02T15:04:05Z0700" .GitInfo.AuthorDate.Local | safeHTML }}</updated>
{{- end }}
<author>{{ .Params.author }}</author> <author>{{ .Params.author }}</author>
<guid isPermaLink="true">{{ .Permalink }}</guid> <guid isPermaLink="true">{{ .Permalink }}</guid>
<description>{{ printf `<![CDATA[%s]]>` .Params.description | safeHTML }}</description> <description>{{ printf `<![CDATA[%s]]>` .Params.description | safeHTML }}</description>
<content:encoded type="html">{{ printf `<![CDATA[%s]]>` .Content | safeHTML }}</content:encoded> {{ $content := .Content}}
{{- if .Params.Cover }}
{{- $content = (printf `%s%s` (partial "image.html" (dict "path" .Params.Cover "alt" (.Title | plainify) "class" "post-cover")) $content) }}
{{- end }}
<content:encoded type="html">{{ printf `<![CDATA[%s]]>` $content | safeHTML }}</content:encoded>
</item> </item>
{{ end }} {{ end }}
</channel> </channel>

@ -1,6 +1,7 @@
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0"> <rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
<channel> <channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<icon>{{"favicon-32x32.png" | absURL}}</icon>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
{{- with .Site.LanguageCode }} {{- with .Site.LanguageCode }}
@ -26,6 +27,10 @@
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<published>{{ .Date.Format "2006-01-02T15:04:05Z0700" | safeHTML }}</published>
{{- if .GitInfo }}
<updated>{{ dateFormat "2006-01-02T15:04:05Z0700" .GitInfo.AuthorDate.Local | safeHTML }}</updated>
{{- end }}
<author>{{ .Site.Author.name }}</author> <author>{{ .Site.Author.name }}</author>
<guid>{{ .Permalink }}</guid> <guid>{{ .Permalink }}</guid>
<description>{{ printf `<![CDATA[%s]]>` .Summary | safeHTML }}</description> <description>{{ printf `<![CDATA[%s]]>` .Summary | safeHTML }}</description>

@ -1,36 +0,0 @@
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
<channel>
<title>XXX {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
{{- with .Site.LanguageCode }}
<language>{{.}}</language>
{{- end }}
{{- with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>
{{- end }}
{{- with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>
{{- end }}
{{- with .Site.Copyright }}
<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 }}
{{- end }}
{{ range .Pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<author>{{ .Params.author }}</author>
<guid isPermaLink="true">{{ .Permalink }}</guid>
<description>{{ printf `<![CDATA[%s]]>` .Params.description | safeHTML }}</description>
<content:encoded type="html">{{ printf `<![CDATA[%s]]>` .Content | safeHTML }}</content:encoded>
</item>
{{ end }}
</channel>
</rss>
Loading…
Cancel
Save