You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
3.7 KiB
XML

{{ $page := . }}
{{ $limit := site.Config.Services.RSS.Limit }}
{{ $pages := (cond $page.IsHome site $page).RegularPages }}
{{ $title := partial "paige/title.html" $page }}
{{ $pages = where $pages "Params.paige.feed.hide_page" "ne" true }}
{{ if ge $limit 0 }}
{{ $pages = $pages | first $limit }}
{{ end }}
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
{{ printf `<atom:link href="%s" rel="self" type="application/rss+xml"/>` ($page.Permalink | safeURL) | safeHTML }}
{{ with $page.AlternativeOutputFormats.Get "html" }}
{{ printf `<atom:link href="%s" rel="alternate" type="%s"/>` (.Permalink | safeURL) .MediaType | safeHTML }}
{{ end }}
{{ with site.Copyright }}
<copyright>{{ . }}</copyright>
{{ end }}
<description>{{ with $title -}} {{- . -}} {{- else -}} Recent content {{- end }}</description>
{{ with site.LanguageCode | default site.Language.Lang }}
<language>{{ . }}</language>
{{ end }}
{{ if and $page.PublishDate (not $page.PublishDate.IsZero) }}
<lastBuildDate>{{ $page.PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</lastBuildDate>
{{ end }}
<link>{{ $page.Permalink }}</link>
{{ with $page.Param "paige.feed.rss.managing_editor_email" }}
<managingEditor>{{ . }}</managingEditor>
{{ end }}
{{ with $title }}
<title>{{ . }}</title>
{{ end }}
{{ with $page.Param "paige.feed.rss.web_master_email" }}
<webMaster>{{ . }}</webMaster>
{{ end }}
{{ range $pages }}
<item>
{{ with partial "paige/authors.html" . }}
{{ $authors := slice }}
{{ range . }}
{{ $authors = $authors | append .name }}
{{ end }}
<author>{{ delimit $authors ", " }}</author>
{{ end }}
{{ if .Content }}
<description>{{ printf "<![CDATA[%s]]>" .Content | safeHTML }}</description>
{{ else if .Description }}
<description>{{ printf "<![CDATA[%s]]>" (.Description | markdownify) | safeHTML }}</description>
{{ end }}
{{ $guid := "" }}
{{ $permalink := false }}
{{ if .Params.id }}
{{ $guid = .Params.id }}
{{ else if not .Date.IsZero }}
{{ $guid = printf "tag:%s,%s:%s" (urls.Parse site.BaseURL).Host (.Date.Format "2006-01-02") (.Date.Format "2006-01-02T15:04:05Z07:00") }}
{{ else }}
{{ $guid = .RelPermalink }}
{{ $permalink = false }}
{{ end }}
<guid {{ if not $permalink }} isPermaLink="false" {{ end }}>{{ $guid }}</guid>
{{ if and .Params.link (not (.Param "paige.feed.atom.link_to_page")) }}
<link>{{ .Params.link | safeURL }}</link>
{{ else }}
<link>{{ .Permalink | safeURL }}</link>
{{ end }}
{{ with .PublishDate }}
<pubDate>{{ .Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</pubDate>
{{ end }}
{{ with .Title }}
<title>{{ . | markdownify | plainify | htmlUnescape | safeHTML }}</title>
{{ end }}
{{ if and (not .Description) (not .Title) }}
{{ warnf "layouts/_default/rss.xml: Page %s does not have a title or description" .RelPermalink }}
{{ end }}
</item>
{{ end }}
</channel>
</rss>