From 9ab68cefd02b8340994880b7158789a125069174 Mon Sep 17 00:00:00 2001 From: tdro Date: Mon, 28 Nov 2022 16:34:49 -0500 Subject: themes/default/layouts/partials/function-generate-feeds: Allow retitling feeds By appending to data sequence: feeds: rss: - https://codeberg.org/tdro/canory.rss Canory --- themes/default/layouts/partials/function-generate-feeds.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/themes/default/layouts/partials/function-generate-feeds.html b/themes/default/layouts/partials/function-generate-feeds.html index 547a7e3..545e1b8 100644 --- a/themes/default/layouts/partials/function-generate-feeds.html +++ b/themes/default/layouts/partials/function-generate-feeds.html @@ -6,13 +6,17 @@ {{- range $key, $value := (seq 3) -}} {{- range $author.feeds.rss -}} - {{- with resources.GetRemote . -}} + {{- $data := split . " " -}} + {{- $url := delimit (first 1 $data) "" -}} + {{- $retitle := delimit (after 1 $data) " " -}} + + {{- with resources.GetRemote $url -}} {{- with .Err -}} {{- warnf "Feed fetch %s" . -}} {{- end -}} {{- end -}} - {{- with resources.GetRemote . | transform.Unmarshal -}} + {{- with resources.GetRemote $url | transform.Unmarshal -}} {{- $content := "" -}} {{- $date := now.Format "2006-01-02T15:04:05Z" -}} @@ -172,7 +176,7 @@ "FeedEnclosure" ($enclosure | plainify | html | htmlUnescape) "FeedImageLink" ($imageLink | plainify | html | htmlUnescape) "FeedLink" ($link | plainify | html | htmlUnescape) - "FeedName" (delimit ((delimit (first 2 (split ($sourceTitle | plainify | html | htmlUnescape) " ")) " ") | findRE "^([^.|?|!|\n|\"|]+)") " " | replaceRE "[^a-zA-Z ]" "") + "FeedName" (or $retitle (delimit (first 2 (split ($sourceTitle | plainify | html | htmlUnescape) " ")) " ")) "FeedSourceDescription" ($sourceDescription | plainify | html | htmlUnescape) "FeedSourceDomain" ($sourceDomain | plainify | html | htmlUnescape) "FeedSourceLink" ($sourceLink | plainify | html | htmlUnescape) -- cgit v1.2.3