From 2aeec6475707eac86b24a9c16499bbe1b0a4d112 Mon Sep 17 00:00:00 2001 From: tdro Date: Wed, 5 Oct 2022 01:47:40 -0400 Subject: themes/default/layouts/partials/generate-feeds: Ensure descriptions are used Fallback to title on empty web ring content. --- .../default/layouts/partials/generate-feeds.html | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/themes/default/layouts/partials/generate-feeds.html b/themes/default/layouts/partials/generate-feeds.html index f502543..ec550d3 100644 --- a/themes/default/layouts/partials/generate-feeds.html +++ b/themes/default/layouts/partials/generate-feeds.html @@ -14,7 +14,7 @@ {{- with resources.GetRemote . | transform.Unmarshal -}} - {{- $content := "No content found." -}} + {{- $content := "" -}} {{- $date := now.Format "2006-01-02T15:04:05Z" -}} {{- $description := "No description found." -}} {{- $enclosure := "" -}} @@ -200,10 +200,10 @@ {{- $imageSource := partial "function-caches-images.html" (dict - "Source" $faviconDomain - "Fit" "160x160" - "Target" (print (partial "function-paths.html" "media") "/") - "Copy" (print (partial "function-paths.html" "media") "/favicon." $domain ".png") + "Source" $faviconDomain + "Fit" "160x160" + "Target" (print (partial "function-paths.html" "media") "/") + "Copy" (print (partial "function-paths.html" "media") "/favicon." $domain ".png") ) -}} @@ -212,21 +212,21 @@ {{- $file = partial "function-strip-urlchars.html" $file -}} {{- $path := print "/data/generates/content/" $author.user "/feeds/" $file ".md" -}} - {{- $description := .FeedDescriptionShort -}} - {{- if gt (len .FeedTitle) (len .FeedDescriptionShort) -}} - {{- $description = .FeedTitle -}} - {{- end -}} - {{- $content := .FeedContentShort -}} - {{- if or (eq $content "No content found.") (gt (len .FeedTitle) (len $content)) -}} + + {{- if (gt (len .FeedTitle) (len $content)) -}} {{- $content = .FeedTitle -}} {{- end -}} + {{- if (gt (len .FeedDescriptionShort) (len .FeedTitle)) -}} + {{- $content = .FeedDescriptionShort -}} + {{- end -}} + {{- $markdown := resources.ExecuteAsTemplate $path (dict "author" $author.user - "content" $content + "content" (or $content "No content found.") "date" .FeedDateTime "description" (or .FeedSourceDescription .FeedSourceTitle "No source description found.") "domain" .FeedSourceDomain @@ -264,9 +264,9 @@ {{ .FeedDate }} {{ if gt (len .FeedDescriptionShort) (len .FeedContentShort) -}} - {{ "--" | markdownify }} {{ .FeedDescriptionShort }} + {{ "--" | markdownify }} {{ or .FeedDescriptionShort .FeedTitle }} {{- else -}} - {{ "--" | markdownify }} {{ .FeedContentShort }} + {{ "--" | markdownify }} {{ or .FeedContentShort .FeedTitle }} {{- end }}

-- cgit v1.2.3