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.
157 lines
6.1 KiB
XML
157 lines
6.1 KiB
XML
{{ $page := . }}
|
|
|
|
{{ $build := false }}
|
|
{{ $copyright := site.Copyright | markdownify | plainify | htmlUnescape }}
|
|
{{ $description := or $page.Description (i18n "paige_recent_content") }}
|
|
{{ $editor := $page.Param "paige.feed.rss.managing_editor" }}
|
|
{{ $format := "Mon, 02 Jan 2006 15:04:05 MST" }}
|
|
{{ $language := site.LanguageCode | default site.Language.Lang }}
|
|
{{ $limit := site.Config.Services.RSS.Limit }}
|
|
{{ $link := ($page.AlternativeOutputFormats.Get "html").Permalink }}
|
|
{{ $master := $page.Param "paige.feed.rss.web_master" }}
|
|
{{ $subpages := slice }}
|
|
|
|
{{ range $page.RegularPagesRecursive.ByPublishDate.Reverse }}
|
|
{{ if or (and (not $build) (not .Lastmod.IsZero)) (and $build (lt $build .Lastmod)) }}
|
|
{{ $build = .Lastmod }}
|
|
{{ end }}
|
|
|
|
{{ if not (.Param "paige.feed.disable") }}
|
|
{{ $subpages = $subpages | append . }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ if gt $limit 0 }}
|
|
{{ $subpages = $subpages | first $limit }}
|
|
{{ end }}
|
|
|
|
{{ $titles := slice ($page.Title | markdownify) }}
|
|
|
|
{{ range .Ancestors }}
|
|
{{ $titles = $titles | append (.Title | markdownify) }}
|
|
{{ end }}
|
|
|
|
{{ $title := delimit $titles " · " }}
|
|
|
|
{{ if not $title }}
|
|
{{ warnf "layouts/_default/list.rss.xml: Page %s does not have a title. The rss output requires a title. Either set the page's title parameter, or disable the rss output." $page.RelPermalink }}
|
|
{{ end }}
|
|
|
|
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\"?>" | safeHTML }}
|
|
<rss version="2.0" {{ with $language }} xml:lang="{{ . }}" {{ end }} xmlns:atom="http://www.w3.org/2005/Atom">
|
|
<channel>
|
|
{{ range $page.OutputFormats }}
|
|
{{ $rel := .Rel }}
|
|
|
|
{{ if eq .Permalink $page.Permalink }}
|
|
{{ $rel = "self" }}
|
|
{{ else if eq $rel "canonical" }}
|
|
{{ $rel = "alternate" }}
|
|
{{ end }}
|
|
|
|
{{ if or (eq $rel "alternate") (eq $rel "enclosure") (eq $rel "related") (eq $rel "self") (eq $rel "via") }}
|
|
{{ printf `<link href="%s" rel="%s" type="%s"/>` .Permalink $rel .MediaType | safeHTML }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ range $t := $page.Translations }}
|
|
{{ range .OutputFormats }}
|
|
{{ if or (eq .Rel "alternate") (eq .Rel "enclosure") (eq .Rel "related") (eq .Rel "via") }}
|
|
{{ printf `<link href="%s" hreflang="%s" rel="%s" type="%s"/>` .Permalink $t.Lang .Rel .MediaType | safeHTML }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ with $copyright }}
|
|
<copyright>{{ . }}</copyright>
|
|
{{ end }}
|
|
|
|
<description>{{ $description }}</description>
|
|
|
|
{{ with $language }}
|
|
<language>{{ . }}</language>
|
|
{{ end }}
|
|
|
|
{{ with $build }}
|
|
<lastBuildDate>{{ . }}</lastBuildDate>
|
|
{{ end }}
|
|
|
|
<link>{{ $link }}</link>
|
|
|
|
{{ with $editor }}
|
|
<managingEditor>{{ . }}</managingEditor>
|
|
{{ end }}
|
|
|
|
<title>{{ $title }}</title>
|
|
|
|
{{ with $master }}
|
|
<webMaster>{{ . }}</webMaster>
|
|
{{ end }}
|
|
|
|
{{ range $subpage := $subpages }}
|
|
<item>
|
|
{{ $author := "" }}
|
|
{{ $authors := partial "paige/func-authors.html" . }}
|
|
{{ $description := .Content }}
|
|
{{ $external := and .Params.link (not (.Param "paige.feed.link_to_page")) | not | not }}
|
|
{{ $guid := printf "tag:%s,%s:%s" (urls.Parse site.BaseURL).Host (.PublishDate.Format "2006-01-02") (cond (.Params.id | not) .RelPermalink .Params.id) }}
|
|
{{ $published := .PublishDate.Format $format }}
|
|
{{ $title := .Title | markdownify | plainify | htmlUnescape }}
|
|
|
|
{{ $link := cond $external .Params.link .Permalink }}
|
|
|
|
{{ with $authors }}
|
|
{{ $primary := index . 0 }}
|
|
|
|
{{ if and $primary.Params.paige.author.email $primary.Params.paige.author.name }}
|
|
{{ $author = printf "%s (%s)" $primary.Params.paige.author.email $primary.Params.paige.author.name }}
|
|
{{ else if $primary.Params.email }}
|
|
{{ $author = $primary.Params.email }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ if and $description $external }}
|
|
{{ $text := or (.Param "paige.feed.page_link" | markdownify) "⏎" }}
|
|
|
|
{{ $footer := printf `<p><a href="%s" title="%s">%s</a></p>` .Permalink (htmlEscape $title) $text | safeHTML }}
|
|
|
|
{{ $description = print $description $footer }}
|
|
{{ end }}
|
|
|
|
{{ if not $description }}
|
|
{{ $description = .Description | markdownify }}
|
|
{{ end }}
|
|
|
|
{{ $description = $description | replaceRE `<a href="#fn:(\d+)" class="footnote-ref" role="doc-noteref">` (printf `<a href="%s#fn:$1" class="footnote-ref" role="doc-noteref">` .Permalink) }}
|
|
{{ $description = $description | replaceRE `<a href="#fnref:(\d+)" class="footnote-backref" role="doc-backlink">` (printf `<a href="%s#fnref:$1" class="footnote-backref" role="doc-backlink">` .Permalink) }}
|
|
|
|
{{ if and (not $description) (not $title) }}
|
|
{{ warnf "layouts/_default/rss.xml: Page %s does not have a title or description. The rss output requires a title or description. Either set the page's title or description parameters, or disable the rss output." .RelPermalink }}
|
|
{{ end }}
|
|
|
|
{{ with $author }}
|
|
<author>{{ . }}</author>
|
|
{{ end }}
|
|
|
|
{{ with $description }}
|
|
<description>{{ printf "<![CDATA[%s]]>" . | safeHTML }}</description>
|
|
{{ end }}
|
|
|
|
<guid isPermaLink="false">{{ $guid }}</guid>
|
|
|
|
{{ with $link }}
|
|
<link>{{ . }}</link>
|
|
{{ end }}
|
|
|
|
{{ with $published }}
|
|
<pubDate>{{ . }}</pubDate>
|
|
{{ end }}
|
|
|
|
{{ with $title }}
|
|
<title>{{ . }}</title>
|
|
{{ end }}
|
|
</item>
|
|
{{ end }}
|
|
</channel>
|
|
</rss>
|