From c07b847ff12172afa70c35b8ed7f79d7bfc7a8c8 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Mon, 3 Jun 2024 21:37:29 -0700 Subject: [PATCH] Use rel permalink as feed ID fallback --- layouts/_default/list.atom.xml | 10 +--------- layouts/_default/list.rss.xml | 14 ++------------ 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/layouts/_default/list.atom.xml b/layouts/_default/list.atom.xml index 49f185b0..cd0401ae 100644 --- a/layouts/_default/list.atom.xml +++ b/layouts/_default/list.atom.xml @@ -118,7 +118,7 @@ {{ range $subpage := $subpages }} {{ $content := .Content }} - {{ $id := "" }} + {{ $id := printf "tag:%s,%s:%s" (urls.Parse site.BaseURL).Host (.PublishDate.Format "2006-01-02") (cond (.Params.id | not) .RelPermalink .Params.id) }} {{ $paramlink := and .Params.link (not (.Param "paige.feed.link_to_page")) | not | not }} {{ $published := cond (not .PublishDate.IsZero) (.PublishDate.Format $format) "" }} {{ $rights := site.Copyright | markdownify }} @@ -139,14 +139,6 @@ {{ $content = .Description | markdownify}} {{ end }} - {{ if .Params.id }} - {{ $id = printf "%s?id=%v" (urls.JoinPath site.BaseURL "/") .Params.id }} - {{ else if not .Date.IsZero }} - {{ $id = printf "tag:%s,%s:%s" (urls.Parse site.BaseURL).Host (.Date.Format "2006-01-02") (.Date.Format $format) }} - {{ else }} - {{ $id = .Permalink }} - {{ end }} - {{ with index $ids $id }} {{ warnf "layouts/_default/list.atom.xml: pages %s and %s have the same ID" . $subpage.RelPermalink }} {{ end }} diff --git a/layouts/_default/list.rss.xml b/layouts/_default/list.rss.xml index ee58198a..5cbb2906 100644 --- a/layouts/_default/list.rss.xml +++ b/layouts/_default/list.rss.xml @@ -74,9 +74,8 @@ {{ $author := "" }} {{ $authors := partial "paige/authors.html" . }} {{ $description := .Content }} - {{ $guid := "" }} + {{ $guid := printf "tag:%s,%s:%s" (urls.Parse site.BaseURL).Host (.PublishDate.Format "2006-01-02") (cond (.Params.id | not) .RelPermalink .Params.id) }} {{ $paramlink := and .Params.link (not (.Param "paige.feed.link_to_page")) | not | not }} - {{ $permalink := false }} {{ $pubdate := .PublishDate.Format $format }} {{ $title := .Title | markdownify | plainify | htmlUnescape }} @@ -110,15 +109,6 @@ {{ 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 }} @@ -133,7 +123,7 @@ {{ printf "" . | safeHTML }} {{ end }} - {{ $guid }} + {{ $guid }} {{ with $link }} {{ . }}