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.
155 lines
5.8 KiB
XML
155 lines
5.8 KiB
XML
{{ $page := . }}
|
|
|
|
{{ $copyright := site.Copyright }}
|
|
{{ $description := or $page.Description "Recent content" }}
|
|
{{ $format := "Mon, 02 Jan 2006 15:04:05 MST" }}
|
|
{{ $guids := dict }}
|
|
{{ $html := $page.AlternativeOutputFormats.Get "html" }}
|
|
{{ $language := site.LanguageCode | default site.Language.Lang }}
|
|
{{ $lastbuilddate := (partial "paige/changed.html" $page).Format $format }}
|
|
{{ $limit := site.Config.Services.RSS.Limit }}
|
|
{{ $link := ($page.AlternativeOutputFormats.Get "html").Permalink }}
|
|
{{ $managingeditor := $page.Param "paige.feed.rss.managing_editor" }}
|
|
{{ $pagetitle := $page.Title | markdownify | plainify }}
|
|
{{ $sitetitle := site.Title | markdownify | plainify }}
|
|
{{ $subpages := slice }}
|
|
{{ $title := "" }}
|
|
{{ $webmaster := $page.Param "paige.feed.rss.web_master" }}
|
|
|
|
{{ range (cond $page.IsHome site $page).RegularPages }}
|
|
{{ if not (.Param "paige.feed.hide_page") }}
|
|
{{ $subpages = $subpages | append . }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ if gt $limit 0 }}
|
|
{{ $subpages = $subpages | first $limit }}
|
|
{{ end }}
|
|
|
|
{{ if and $pagetitle $sitetitle }}
|
|
{{ if $page.IsHome }}
|
|
{{ $title = $pagetitle }}
|
|
{{ else }}
|
|
{{ $title = printf "%s · %s" $pagetitle $sitetitle }}
|
|
{{ end }}
|
|
{{ else if $pagetitle }}
|
|
{{ $title = $pagetitle }}
|
|
{{ else if $sitetitle }}
|
|
{{ $title = $sitetitle }}
|
|
{{ else }}
|
|
{{ warnf "layouts/_default/rss.xml: page %s does not have a title" $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>
|
|
{{ printf `<atom:link href="%s" rel="self" type="application/rss+xml"/>` $page.Permalink | safeHTML }}
|
|
|
|
{{ with $copyright }}
|
|
<copyright>{{ . }}</copyright>
|
|
{{ end }}
|
|
|
|
<description>{{ $description }}</description>
|
|
|
|
{{ with $language }}
|
|
<language>{{ . }}</language>
|
|
{{ end }}
|
|
|
|
{{ with $lastbuilddate }}
|
|
<lastBuildDate>{{ . }}</lastBuildDate>
|
|
{{ end }}
|
|
|
|
<link>{{ $link }}</link>
|
|
|
|
{{ with $managingeditor }}
|
|
<managingEditor>{{ . }}</managingEditor>
|
|
{{ end }}
|
|
|
|
<title>{{ $title }}</title>
|
|
|
|
{{ with $webmaster }}
|
|
<webMaster>{{ . }}</webMaster>
|
|
{{ end }}
|
|
|
|
{{ range $subpage := $subpages }}
|
|
<item>
|
|
{{ $author := "" }}
|
|
{{ $authors := partial "paige/authors.html" . }}
|
|
{{ $description := .Content }}
|
|
{{ $guid := "" }}
|
|
{{ $paramlink := and .Params.link (not (.Param "paige.feed.link_to_page")) | not | not }}
|
|
{{ $permalink := false }}
|
|
{{ $pubdate := .PublishDate.Format $format }}
|
|
{{ $title := .Title | markdownify | plainify }}
|
|
|
|
{{ $link := cond $paramlink .Params.link .Permalink }}
|
|
|
|
{{ with $authors }}
|
|
{{ $primary := index . 0 }}
|
|
|
|
{{ if and $primary.name $primary.email }}
|
|
{{ $author = printf "%s (%s)" $primary.email $primary.name }}
|
|
{{ else if $primary.email }}
|
|
{{ $author = $primary.email }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ if and $description $paramlink }}
|
|
{{ $pagelink := or (.Param "paige.feed.page_link" | markdownify) "⏎" }}
|
|
{{ $footer := printf `<p><a href="%s" title="%s">%s</a></p>` .Permalink $title $pagelink }}
|
|
|
|
{{ $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" .RelPermalink }}
|
|
{{ end }}
|
|
|
|
{{ 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 = .Permalink }}
|
|
{{ $permalink = false }}
|
|
{{ end }}
|
|
|
|
{{ with index $guids $guid }}
|
|
{{ warnf "layouts/_default/rss.xml: pages %s and %s have the same GUID" . $subpage.RelPermalink }}
|
|
{{ end }}
|
|
|
|
{{ $guids = merge (dict $guid .RelPermalink) $guids }}
|
|
|
|
{{ with $author }}
|
|
<author>{{ . }}</author>
|
|
{{ end }}
|
|
|
|
{{ with $description }}
|
|
<description>{{ printf "<![CDATA[%s]]>" . | safeHTML }}</description>
|
|
{{ end }}
|
|
|
|
<guid {{ if not $permalink }} isPermaLink="false" {{ end }}>{{ $guid }}</guid>
|
|
|
|
{{ with $link }}
|
|
<link>{{ . }}</link>
|
|
{{ end }}
|
|
|
|
{{ with $pubdate }}
|
|
<pubDate>{{ . }}</pubDate>
|
|
{{ end }}
|
|
|
|
{{ with $title }}
|
|
<title>{{ . }}</title>
|
|
{{ end }}
|
|
</item>
|
|
{{ end }}
|
|
</channel>
|
|
</rss>
|