Add a shortcode to embed a photo post in a blog post

This commit is contained in:
Eryn Wells 2022-10-30 11:31:47 -07:00
parent e7b2cb493a
commit 57947282ce
2 changed files with 16 additions and 0 deletions

View file

@ -0,0 +1,8 @@
{{- $thumbnailResource := .Resources.GetMatch (index .Page.Params "thumbnail")
| default (index (.Page.Resources.ByType "image") 0) -}}
{{- if not $thumbnailResource -}}
{{- errorf "No thumbnail available for %s" .Page.Permalink }}
{{- end -}}
{{- $orientation := partial "images/orientation_angle.html" $thumbnailResource -}}
{{- $thumbnail := $thumbnailResource.Fit (printf "%dx%d r%d" .Width .Height (sub 360 $orientation)) -}}
{{ return $thumbnail }}