Clean up formatting of photo shortcode

This commit is contained in:
Eryn Wells 2022-11-03 17:03:25 -07:00
parent 3f1bd948eb
commit 0f47ca61a6

View file

@ -1,8 +1,9 @@
{{- with $photoPage := $.Page.GetPage (printf "photos/%s" (.Get 0)) -}}
{{- $thumbnail := partial "images/photo_thumbnail.html" (dict "Page" . "Width" 1280 "Height" 1280) -}}
<a href="{{ .RelPermalink }}" title="{{ .Title }}">
<img src="{{ $thumbnail.RelPermalink }}" {{/*{{ with $altText }}alt="{{ . }}"{{ end }}*/}}>
</a>
{{- $thumbnail := partial "images/photo_thumbnail.html" (dict "Page" . "Width" 1280 "Height" 1280) -}}
{{- $altText := $thumbnail.Params.alt | default .Title -}}
<a href="{{ .RelPermalink }}" title="{{ .Title }}">
<img src="{{ $thumbnail.RelPermalink }}"{{ with $altText }} alt="{{ . }}"{{ end }}>
</a>
{{- else -}}
{{- errorf "No page matching '%s'" (.Get 0) -}}
{{- errorf "No page matching '%s'" (.Get 0) -}}
{{- end -}}