aboutsummaryrefslogtreecommitdiff
path: root/assets/templates
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-06-05 00:55:53 -0400
committertdro <tdro@noreply.example.com>2022-06-05 00:55:53 -0400
commit4c559daf909f025c5e8761e27be6a02fb5f2608f (patch)
tree2b87099fc6bd55f72d794d59995084ff4ccc00ea /assets/templates
parent49807a0d253e5df7c12990b16cd9c1ef6aef6dab (diff)
downloadcanory-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.yaml22
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 "{" "&#123;"
| replaceRE "}" "&#125;"
}} [Read More &rarr;]({{ .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 }}