diff options
author | tdro <tdro@noreply.example.com> | 2022-06-05 00:55:53 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2022-06-05 00:55:53 -0400 |
commit | 4c559daf909f025c5e8761e27be6a02fb5f2608f (patch) | |
tree | 2b87099fc6bd55f72d794d59995084ff4ccc00ea /assets/templates | |
parent | 49807a0d253e5df7c12990b16cd9c1ef6aef6dab (diff) | |
download | canory-4c559daf909f025c5e8761e27be6a02fb5f2608f.tar.gz canory-4c559daf909f025c5e8761e27be6a02fb5f2608f.tar.bz2 canory-4c559daf909f025c5e8761e27be6a02fb5f2608f.zip |
themes/default/layouts/partials/feeds-generate: Naively support enclosures
Support showing enclosure images in feeds. The goal is not to be accurate
right now.
Diffstat (limited to 'assets/templates')
-rw-r--r-- | assets/templates/markdown-feed.yaml | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/assets/templates/markdown-feed.yaml b/assets/templates/markdown-feed.yaml index bf883c0..8361144 100644 --- a/assets/templates/markdown-feed.yaml +++ b/assets/templates/markdown-feed.yaml @@ -11,6 +11,7 @@ feed: {{ range $key, $value := . -}} {{- if and + (ne $key "author") (ne $key "content") (ne $key "date") (ne $key "tags") @@ -24,3 +25,24 @@ feed: | replaceRE "{" "{" | replaceRE "}" "}" }} [Read More →]({{ .link }}) + +{{ with .enclosure -}} + +{{- $author := "default" -}} +{{- with $.author -}} + {{ $author = . }} +{{- end -}} + +{{- $description := "Image/Picture" -}} +{{- with $.description -}} + {{ $description = . | htmlEscape }} +{{- end -}} + +{{- with $enclosure := resources.GetRemote . -}} +{{- $enclosure = .Content | resources.FromString (print $author "/media/" ($enclosure | urlize)) -}} +![{{ $description }}]({{ ($enclosure.Resize "600x").RelPermalink }} " + {{ $description }}" +) +{{- end -}} + +{{- end }} |