aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-10-05 01:47:40 -0400
committertdro <tdro@noreply.example.com>2022-10-05 01:47:40 -0400
commit2aeec6475707eac86b24a9c16499bbe1b0a4d112 (patch)
tree0e3c01b2ad56b4a132f2ca162217f0120eca0853
parentb05c0102b5dad160a7cf98e7e2ec21cd0411287a (diff)
downloadcanory-2aeec6475707eac86b24a9c16499bbe1b0a4d112.tar.gz
canory-2aeec6475707eac86b24a9c16499bbe1b0a4d112.tar.bz2
canory-2aeec6475707eac86b24a9c16499bbe1b0a4d112.zip
themes/default/layouts/partials/generate-feeds: Ensure descriptions are used
Fallback to title on empty web ring content.
-rw-r--r--themes/default/layouts/partials/generate-feeds.html28
1 files 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 }}
</time>
{{ if gt (len .FeedDescriptionShort) (len .FeedContentShort) -}}
- {{ "--" | markdownify }} {{ .FeedDescriptionShort }}
+ {{ "--" | markdownify }} {{ or .FeedDescriptionShort .FeedTitle }}
{{- else -}}
- {{ "--" | markdownify }} {{ .FeedContentShort }}
+ {{ "--" | markdownify }} {{ or .FeedContentShort .FeedTitle }}
{{- end }}
</p>