diff --git a/layouts/partials/images/photo_thumbnail.html b/layouts/partials/images/photo_thumbnail.html new file mode 100644 index 0000000..16940a3 --- /dev/null +++ b/layouts/partials/images/photo_thumbnail.html @@ -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 }} diff --git a/layouts/shortcodes/photo.html b/layouts/shortcodes/photo.html new file mode 100644 index 0000000..f5e0937 --- /dev/null +++ b/layouts/shortcodes/photo.html @@ -0,0 +1,8 @@ +{{- with $photoPage := $.Page.GetPage (printf "photos/%s" (.Get 0)) -}} + {{- $thumbnail := partial "images/photo_thumbnail.html" (dict "Page" . "Width" 1280 "Height" 1280) -}} + + + +{{- else -}} + {{- errorf "No page matching '%s'" (.Get 0) -}} +{{- end -}}