Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save frankmeeuwsen/dd84d96a6efcfd317055fe78968fdc72 to your computer and use it in GitHub Desktop.
Save frankmeeuwsen/dd84d96a6efcfd317055fe78968fdc72 to your computer and use it in GitHub Desktop.
Template RSS 2.0 for use with XSL in micro.blog
{{- printf "<?xml-stylesheet href=\"/css/rss.xsl\" type=\"text/xsl\"?>" | safeHTML -}}
<rss version="2.0">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description></description>
<image>
<url>{{ .Site.Author.avatar }}</url>
<title>The avatar of the author of this website</title>
<link>{{ .Permalink }}</link>
</image>
{{ with .Site.LanguageCode }}
<language>{{.}}</language>
{{ end }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>
{{- $list := first 25 (where .Site.Pages "Type" "post") -}}
{{ range $list }}
<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}}
{{- if .Params.guid }}
<guid>{{ .Params.guid }}</guid>
{{- else -}}
<guid>{{ .Permalink }}</guid>
{{- end }}
<description>{{- .Content | html -}}</description>
</item>
{{ end }}
</channel>
</rss>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment