redstrate.com/themes/red/layouts/_default/rss.xml

69 lines
2.5 KiB
XML

{{- $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 "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" 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"
xml:base="{{ .Site.BaseURL }}">
<channel>
<title>{{ .Site.Params.author }}'s Blog</title>
<link>{{ .Permalink }}</link>
<description>My blog where I post about the things I like and work on!</description>
{{ with .Site.LanguageCode }}<language>{{.}}</language>{{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 -}}
<docs>https://www.rssboard.org/rss-specification</docs>
{{ with resources.Get "rss-image.png" }}
<image>
<url>{{ .Permalink }}</url>
<title>{{ $.Site.Params.author }}'s Art</title>
<link>{{ $.Permalink }}</link>
<width>100</width>
<height>100</height>
</image>
{{ end }}
{{ range $pages }}
{{ if not (.Param "excludefeed") }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
{{ with $.Site.Params.author }}
<author>{{ . }}</author>
{{ end }}
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<guid>{{ .Permalink }}</guid>
<description>{{ "<![CDATA[" | safeHTML }} {{ .Summary }}]]></description>
<content:encoded>{{ "<![CDATA[" | safeHTML }} {{ partial "rss.html" . | safeHTML }}]]></content:encoded>
</item>
{{ end }}
{{ end }}
</channel>
</rss>