erynwells.me/layouts/shortcodes/photo.html

12 lines
579 B
HTML

{{- with $photoPage := $.Page.GetPage (printf "photos/%s" (.Get 0)) -}}
{{- $thumbnail := partial "photos/thumbnail.html" (dict "Page" . "Width" 1280 "Height" 1280) -}}
{{- $altText := $thumbnail.Params.alt | default .Title -}}
<figure class="figure figure--image">
<a class="to-photo-post" href="{{ .RelPermalink }}" title="{{ .Title }}">
<img src="{{ $thumbnail.RelPermalink }}"{{ with $altText }} alt="{{ . }}"{{ end }}>
</a>
<figcaption>{{ .Title }}</figcaption>
</figure>
{{- else -}}
{{- errorf "No page matching '%s'" (.Get 0) -}}
{{- end -}}