Add a item template for photos in a grid

This commit is contained in:
Eryn Wells 2022-10-19 07:39:19 -07:00
parent ae19e1a777
commit 454618222d

View file

@ -0,0 +1,10 @@
{{- $thumbnailResource := .Resources.GetMatch (index .Params "thumbnail")
| default (index (.Resources.ByType "image") 0) -}}
{{- $thumbnail := $thumbnailResource.Fit "600x600" -}}
{{- $thumbnail := $thumbnail.Crop "600x600" -}}
{{- $altText := $thumbnailResource.Params.alt -}}
<li>
<a href="{{ .RelPermalink }}" title="{{ .Title }}">
<img src="{{ $thumbnail.RelPermalink }}" {{ with $altText }}alt="{{ . }}"{{ end }}>
</a>
</li>