diff --git a/layouts/_default/list.atom.xml b/layouts/_default/list.atom.xml index bfd6aa5f..ec704e5e 100644 --- a/layouts/_default/list.atom.xml +++ b/layouts/_default/list.atom.xml @@ -8,17 +8,11 @@ {{ $limit := site.Config.Services.RSS.Limit }} {{ $logo := $page.Param "paige.feeds.atom.logo" | absLangURL }} {{ $rights := site.Copyright | markdownify }} -{{ $subpages := slice }} +{{ $subpages := $page.RegularPagesRecursive.ByPublishDate.Reverse }} {{ $subtitle := $page.Description | markdownify }} {{ $lastmod := site.Lastmod.Format $date }} -{{ range $page.RegularPagesRecursive.ByPublishDate.Reverse }} - {{ if not (.Param "paige.exclude_feeds") }} - {{ $subpages = $subpages | append . }} - {{ end }} -{{ end }} - {{ if gt $limit 0 }} {{ $subpages = first $limit $subpages }} {{ end }} @@ -99,94 +93,96 @@ {{ $lastmod }} {{ range $subpage := $subpages }} - - {{ $content := .Content }} - {{ $external := and .Params.link (not (.Param "paige.feeds.disable_link")) | not | not }} - {{ $id := printf "tag:%s,%s:%s" (urls.Parse site.BaseURL).Host (.PublishDate.Format "2006-01-02") .RelPermalink }} - {{ $lastmod := .Lastmod.Format $date }} - {{ $published := cond (not .PublishDate.IsZero) (.PublishDate.Format $date) "" }} - {{ $summary := markdownify .Description }} - {{ $title := markdownify .Title }} + {{ if not (.Param "paige.exclude_feeds") }} + + {{ $content := .Content }} + {{ $external := and .Params.link (not (.Param "paige.feeds.disable_link")) | not | not }} + {{ $id := printf "tag:%s,%s:%s" (urls.Parse site.BaseURL).Host (.PublishDate.Format "2006-01-02") .RelPermalink }} + {{ $lastmod := .Lastmod.Format $date }} + {{ $published := cond (not .PublishDate.IsZero) (.PublishDate.Format $date) "" }} + {{ $summary := markdownify .Description }} + {{ $title := markdownify .Title }} - {{ $link := cond $external .Params.link .Permalink }} + {{ $link := cond $external .Params.link .Permalink }} - {{ if and $content $external }} - {{ $text := or (.Param "paige.feeds.page_link" | markdownify) "⏎" }} + {{ if and $content $external }} + {{ $text := or (.Param "paige.feeds.page_link" | markdownify) "⏎" }} - {{ $footer := printf `

%s

` .Permalink (htmlEscape .Title) $text | safeHTML }} - - {{ $content = print $content $footer }} - {{ end }} + {{ $footer := printf `

%s

` .Permalink (htmlEscape .Title) $text | safeHTML }} - {{ if not $content }} - {{ $content = markdownify .Description }} - {{ end }} - - {{ if not $title }} - {{ warnf "layouts/_default/list.atom.xml: Page %s does not have a title. The atom output requires a title. Either set the page's title parameter, or disable the atom output." .RelPermalink }} - {{ end }} + {{ $content = print $content $footer }} + {{ end }} - {{ if .Lastmod.IsZero }} - {{ warnf "layouts/_default/list.atom.xml: Page %s does not have a modified date. The atom output requires a modified date. Either set the page's date parameter, or set the page's paige.feeds.exclude parameter to true, or disable the atom output." .RelPermalink }} - {{ end }} + {{ if not $content }} + {{ $content = markdownify .Description }} + {{ end }} - {{ with partial "paige/func-authors.html" . }} - {{ range . }} - - {{ with .Params.paige.author.email }} - {{ . }} - {{ end }} + {{ if not $title }} + {{ warnf "layouts/_default/list.atom.xml: Page %s does not have a title. The atom output requires a title. Either set the page's title parameter, or disable the atom output." .RelPermalink }} + {{ end }} - {{ with .Params.paige.author.name }} - {{ . }} - {{ end }} + {{ if .Lastmod.IsZero }} + {{ warnf "layouts/_default/list.atom.xml: Page %s does not have a modified date. The atom output requires a modified date. Either set the page's date parameter, or set the page's paige.feeds.exclude parameter to true, or disable the atom output." .RelPermalink }} + {{ end }} - {{ with .Params.paige.author.url }} - {{ . }} - {{ end }} - + {{ with partial "paige/func-authors.html" . }} + {{ range . }} + + {{ with .Params.paige.author.email }} + {{ . }} + {{ end }} + + {{ with .Params.paige.author.name }} + {{ . }} + {{ end }} + + {{ with .Params.paige.author.url }} + {{ . }} + {{ end }} + + {{ end }} {{ end }} - {{ end }} - {{ with $content }} - {{ printf "" . | safeHTML }} - {{ end }} + {{ with $content }} + {{ printf "" . | safeHTML }} + {{ end }} - {{ $id }} + {{ $id }} - {{ range .OutputFormats }} - {{ $rel := cond (eq .Rel "canonical") "alternate" .Rel }} + {{ range .OutputFormats }} + {{ $rel := cond (eq .Rel "canonical") "alternate" .Rel }} - {{ if or (eq $rel "alternate") (eq $rel "enclosure") (eq $rel "related") (eq $rel "via") }} - {{ $href := cond (and (eq $rel "alternate") (eq .MediaType.Type "text/html")) $link .Permalink }} + {{ if or (eq $rel "alternate") (eq $rel "enclosure") (eq $rel "related") (eq $rel "via") }} + {{ $href := cond (and (eq $rel "alternate") (eq .MediaType.Type "text/html")) $link .Permalink }} - + + {{ end }} {{ end }} - {{ end }} - {{ range $t := .Translations }} - {{ range .OutputFormats }} - {{ if or (eq .Rel "alternate") (eq .Rel "enclosure") (eq .Rel "related") (eq .Rel "via") }} - + {{ range $t := .Translations }} + {{ range .OutputFormats }} + {{ if or (eq .Rel "alternate") (eq .Rel "enclosure") (eq .Rel "related") (eq .Rel "via") }} + + {{ end }} {{ end }} {{ end }} - {{ end }} - {{ with $published }} - {{ . }} - {{ end }} + {{ with $published }} + {{ . }} + {{ end }} - {{ with $rights }} - {{ printf "" . | safeHTML }} - {{ end }} + {{ with $rights }} + {{ printf "" . | safeHTML }} + {{ end }} - {{ with $summary }} - {{ printf "" . | safeHTML }} - {{ end }} + {{ with $summary }} + {{ printf "" . | safeHTML }} + {{ end }} - {{ printf `<![CDATA[%s]]>` $title | safeHTML }} + {{ printf `<![CDATA[%s]]>` $title | safeHTML }} - {{ $lastmod }} -
+ {{ $lastmod }} +
+ {{ end }} {{ end }} diff --git a/layouts/_default/list.rss.xml b/layouts/_default/list.rss.xml index 9f38da61..8b8af285 100644 --- a/layouts/_default/list.rss.xml +++ b/layouts/_default/list.rss.xml @@ -8,16 +8,10 @@ {{ $limit := site.Config.Services.RSS.Limit }} {{ $link := ($page.AlternativeOutputFormats.Get "html").Permalink }} {{ $master := $page.Param "paige.feeds.rss.web_master" }} -{{ $subpages := slice }} +{{ $subpages := $page.RegularPagesRecursive.ByPublishDate.Reverse }} {{ $lastmod := site.Lastmod.Format $date }} -{{ range $page.RegularPagesRecursive.ByPublishDate.Reverse }} - {{ if not (.Param "paige.exclude_feeds") }} - {{ $subpages = $subpages | append . }} - {{ end }} -{{ end }} - {{ if gt $limit 0 }} {{ $subpages = $subpages | first $limit }} {{ end }} @@ -87,68 +81,70 @@ {{ end }} {{ range $subpages }} - - {{ $author := "" }} - {{ $authors := partial "paige/func-authors.html" . }} - {{ $description := .Content }} - {{ $external := and .Params.link (not (.Param "paige.feeds.disable_link")) | 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 $date }} - {{ $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 }} + {{ if not (.Param "paige.exclude_feeds") }} + + {{ $author := "" }} + {{ $authors := partial "paige/func-authors.html" . }} + {{ $description := .Content }} + {{ $external := and .Params.link (not (.Param "paige.feeds.disable_link")) | 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 $date }} + {{ $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 }} - {{ end }} - {{ if and $description $external }} - {{ $text := or (.Param "paige.feeds.page_link" | markdownify) "⏎" }} + {{ if and $description $external }} + {{ $text := or (.Param "paige.feeds.page_link" | markdownify) "⏎" }} - {{ $footer := printf `

%s

` .Permalink (htmlEscape $title) $text | safeHTML }} + {{ $footer := printf `

%s

` .Permalink (htmlEscape $title) $text | safeHTML }} - {{ $description = print $description $footer }} - {{ end }} + {{ $description = print $description $footer }} + {{ end }} - {{ if not $description }} - {{ $description = .Description | markdownify }} - {{ end }} + {{ if not $description }} + {{ $description = .Description | markdownify }} + {{ end }} - {{ $description = replaceRE `` (printf `` .Permalink) $description }} - {{ $description = replaceRE `` (printf `` .Permalink) $description }} + {{ $description = replaceRE `` (printf `` .Permalink) $description }} + {{ $description = replaceRE `` (printf `` .Permalink) $description }} - {{ 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 }} + {{ 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 }} - {{ . }} - {{ end }} + {{ with $author }} + {{ . }} + {{ end }} - {{ with $description }} - {{ printf "" . | safeHTML }} - {{ end }} + {{ with $description }} + {{ printf "" . | safeHTML }} + {{ end }} - {{ $guid }} + {{ $guid }} - {{ with $link }} - {{ . }} - {{ end }} + {{ with $link }} + {{ . }} + {{ end }} - {{ with $published }} - {{ . }} - {{ end }} + {{ with $published }} + {{ . }} + {{ end }} - {{ with $title }} - {{ . }} - {{ end }} -
+ {{ with $title }} + {{ . }} + {{ end }} +
+ {{ end }} {{ end }}