aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-08-09 03:59:27 -0400
committertdro <tdro@noreply.example.com>2022-08-09 03:59:27 -0400
commit5aad7b6e4baab33a9445713bef8ecfc6aa5560db (patch)
treec72db49b64e8076434968b5204dca05090c4dbfd
parentc4352c55302cc9f106ef41736d21ebac3bf909ef (diff)
downloadcanory-5aad7b6e4baab33a9445713bef8ecfc6aa5560db.tar.gz
canory-5aad7b6e4baab33a9445713bef8ecfc6aa5560db.tar.bz2
canory-5aad7b6e4baab33a9445713bef8ecfc6aa5560db.zip
themes/default/layouts/partials/generate-feeds: Resolve feed image
-rw-r--r--themes/default/layouts/partials/generate-feeds.html28
1 files changed, 19 insertions, 9 deletions
diff --git a/themes/default/layouts/partials/generate-feeds.html b/themes/default/layouts/partials/generate-feeds.html
index 19afd1b..fefce72 100644
--- a/themes/default/layouts/partials/generate-feeds.html
+++ b/themes/default/layouts/partials/generate-feeds.html
@@ -14,15 +14,16 @@
{{- with resources.GetRemote . | transform.Unmarshal -}}
- {{- $title := "No Title Found" -}}
- {{- $link := "https://example.com/link" -}}
- {{- $description := "No description found." -}}
- {{- $content := "No content found." -}}
- {{- $sourceTitle := "No source title found" -}}
- {{- $sourceLink := "https://example.com/" -}}
- {{- $sourceDescription := "No source description found." -}}
- {{- $date := now.Format "2006-01-02T15:04:05Z" -}}
- {{- $enclosure := "" -}}
+ {{- $content := "No content found." -}}
+ {{- $date := now.Format "2006-01-02T15:04:05Z" -}}
+ {{- $description := "No description found." -}}
+ {{- $enclosure := "" -}}
+ {{- $imageLink := "" -}}
+ {{- $link := "https://example.com/link" -}}
+ {{- $sourceDescription := "No source description found." -}}
+ {{- $sourceLink := "https://example.com/" -}}
+ {{- $sourceTitle := "No source title found" -}}
+ {{- $title := "No Title Found" -}}
{{- with .channel -}}
@@ -39,6 +40,10 @@
{{- $sourceLink = .link -}}
{{- end -}}
+ {{- with .image -}}
+ {{- $imageLink = .url -}}
+ {{- end -}}
+
{{- with .item -}}
{{- if reflect.IsMap . -}}
{{- $title = index . "title" -}}
@@ -156,6 +161,7 @@
"FeedDescription" ($description | plainify | htmlUnescape)
"FeedDescriptionShort" (delimit (first 2 (split ($description | plainify | htmlUnescape) "\n")) " " | truncate 250)
"FeedEnclosure" ($enclosure | plainify | htmlUnescape)
+ "FeedImageLink" ($imageLink | plainify | htmlUnescape)
"FeedLink" ($link | plainify | htmlUnescape)
"FeedName" (delimit ((delimit (first 2 (split ($sourceTitle | plainify | htmlUnescape) " ")) " ") | findRE "^([^.|?|!|\n|\"|]+)") " " | replaceRE "[^a-zA-Z ]" "")
"FeedSourceDescription" ($sourceDescription | plainify | htmlUnescape)
@@ -181,6 +187,10 @@
)
-}}
+ {{- with .FeedImageLink -}}
+ {{- $faviconDomain = . -}}
+ {{- end -}}
+
{{- $imageSource := partial "function-feeds-favicons.html"
(dict
"Domain" .FeedSourceDomain