master
Will Faught 2 years ago
parent f9379656a6
commit 881638103b

@ -37,27 +37,37 @@
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
{{ printf `<atom:link href="%s" rel="self" type="application/rss+xml"/>` ($page.Permalink | safeURL) | safeHTML }} {{ printf `<atom:link href="%s" rel="self" type="application/rss+xml"/>` ($page.Permalink | safeURL) | safeHTML }}
{{ with $html }} {{ with $html }}
{{ printf `<atom:link href="%s" rel="alternate" type="%s"/>` (.Permalink | safeURL) .MediaType | safeHTML }} {{ printf `<atom:link href="%s" rel="alternate" type="%s"/>` (.Permalink | safeURL) .MediaType | safeHTML }}
{{ end }} {{ end }}
{{ with $copyright }} {{ with $copyright }}
<copyright>{{ . }}</copyright> <copyright>{{ . }}</copyright>
{{ end }} {{ end }}
<description>{{ $description }}</description> <description>{{ $description }}</description>
{{ with $language }} {{ with $language }}
<language>{{ . }}</language> <language>{{ . }}</language>
{{ end }} {{ end }}
{{ with $lastbuilddate }} {{ with $lastbuilddate }}
<lastBuildDate>{{ . }}</lastBuildDate> <lastBuildDate>{{ . }}</lastBuildDate>
{{ end }} {{ end }}
<link>{{ $link }}</link> <link>{{ $link }}</link>
{{ with $managingeditor }} {{ with $managingeditor }}
<managingEditor>{{ . }}</managingEditor> <managingEditor>{{ . }}</managingEditor>
{{ end }} {{ end }}
<title>{{ $title }}</title> <title>{{ $title }}</title>
{{ with $webmaster }} {{ with $webmaster }}
<webMaster>{{ . }}</webMaster> <webMaster>{{ . }}</webMaster>
{{ end }} {{ end }}
{{ range $subpage := $subpages }} {{ range $subpage := $subpages }}
<item> <item>
{{ $authors := partial "paige/authors.html" . }} {{ $authors := partial "paige/authors.html" . }}
@ -67,17 +77,22 @@
{{ $permalink := false }} {{ $permalink := false }}
{{ $pubdate := .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 MST" }} {{ $pubdate := .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 MST" }}
{{ $title := .Title | markdownify | plainify }} {{ $title := .Title | markdownify | plainify }}
{{ $link := cond $paramlink .Params.link .Permalink }} {{ $link := cond $paramlink .Params.link .Permalink }}
{{ with $authors }} {{ with $authors }}
{{ $primary := index . 0 }} {{ $primary := index . 0 }}
{{ $author := "" }} {{ $author := "" }}
{{ if and $primary.name $primary.email }} {{ if and $primary.name $primary.email }}
{{ $author = printf `%s <%s>` $primary.name $primary.email }} {{ $author = printf `%s <%s>` $primary.name $primary.email }}
{{ else if $primary.email }} {{ else if $primary.email }}
{{ $author = $primary.email }} {{ $author = $primary.email }}
{{ end }} {{ end }}
<author>{{ $author }}</author> <author>{{ $author }}</author>
{{ end }} {{ end }}
{{ if $description }} {{ if $description }}
{{ if $paramlink }} {{ if $paramlink }}
{{ $link := or (.Param "paige.feed.page_link" | markdownify) "⏎" }} {{ $link := or (.Param "paige.feed.page_link" | markdownify) "⏎" }}
@ -85,10 +100,13 @@
{{ $description = print $description $footer }} {{ $description = print $description $footer }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ if not $description }} {{ if not $description }}
{{ $description = .Description | markdownify}} {{ $description = .Description | markdownify}}
{{ end }} {{ end }}
<description>{{ printf "<![CDATA[%s]]>" $description | safeHTML }}</description> <description>{{ printf "<![CDATA[%s]]>" $description | safeHTML }}</description>
{{ if .Params.id }} {{ if .Params.id }}
{{ $guid = .Params.id }} {{ $guid = .Params.id }}
{{ else if not .Date.IsZero }} {{ else if not .Date.IsZero }}
@ -97,20 +115,26 @@
{{ $guid = .RelPermalink }} {{ $guid = .RelPermalink }}
{{ $permalink = false }} {{ $permalink = false }}
{{ end }} {{ end }}
{{ with index $guids $guid }} {{ with index $guids $guid }}
{{ warnf "layouts/_default/rss.xml: Pages %s and %s have the same GUID" . $subpage.RelPermalink }} {{ warnf "layouts/_default/rss.xml: Pages %s and %s have the same GUID" . $subpage.RelPermalink }}
{{ end }} {{ end }}
{{ $guids = merge (dict $guid .RelPermalink) $guids }} {{ $guids = merge (dict $guid .RelPermalink) $guids }}
<guid {{ if not $permalink }} isPermaLink="false" {{ end }}>{{ $guid }}</guid> <guid {{ if not $permalink }} isPermaLink="false" {{ end }}>{{ $guid }}</guid>
{{ with $link }} {{ with $link }}
<link>{{ . }}</link> <link>{{ . }}</link>
{{ end }} {{ end }}
{{ with $pubdate }} {{ with $pubdate }}
<pubDate>{{ . }}</pubDate> <pubDate>{{ . }}</pubDate>
{{ end }} {{ end }}
{{ with $title }} {{ with $title }}
<title>{{ . }}</title> <title>{{ . }}</title>
{{ end }} {{ end }}
{{ if and (not .Description) (not .Title) }} {{ if and (not .Description) (not .Title) }}
{{ warnf "layouts/_default/rss.xml: Page %s does not have a title or description" .RelPermalink }} {{ warnf "layouts/_default/rss.xml: Page %s does not have a title or description" .RelPermalink }}
{{ end }} {{ end }}

Loading…
Cancel
Save