Embed the image of a photo post link in a <figure>

This commit is contained in:
Eryn Wells 2024-10-26 08:31:14 -06:00
parent e65a680b49
commit b72441b9b1

View file

@ -1,9 +1,12 @@
{{- 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 -}}
<a class="to-photo-post" href="{{ .RelPermalink }}" title="{{ .Title }}">
<img src="{{ $thumbnail.RelPermalink }}"{{ with $altText }} alt="{{ . }}"{{ end }}>
</a>
<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 -}}