diff options
Diffstat (limited to 'layouts/partials/leading_image.html')
-rw-r--r-- | layouts/partials/leading_image.html | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/layouts/partials/leading_image.html b/layouts/partials/leading_image.html new file mode 100644 index 0000000..1b5cf28 --- /dev/null +++ b/layouts/partials/leading_image.html @@ -0,0 +1,31 @@ +{{ $image := "" }} +{{ if (.Resources.ByType "image").GetMatch "*featured*" }} + {{ $image = (.Resources.ByType "image").GetMatch "*featured*" }} +{{ else if resources.Get (index .Params.images 0) }} + {{ $image = resources.Get (index .Params.images 0) }} +{{ end }} +{{ with $image }} + <div class="text-center"> + <div class="relative inline-block"> + <img + {{ if ne .MediaType.SubType "svg" }} + {{ $image := .Fit (default "768x400 webp" $.Params.image_size) }} + width="{{ $image.Width }}" height="{{ $image.Height }}" + src="{{ $image.RelPermalink }}" + {{ else }} + src="{{ $image.RelPermalink }}" + {{ end }} + class="m-0" + alt="{{ .Title }}" + /> + {{ with $.Params.caption }} + <a + href="{{ .url }}" + class="text-white block absolute bottom-0 right-0 p-2 bg-black bg-opacity-40 rounded" + > + {{ .text }} + </a> + {{ end }} + </div> + </div> +{{ end }} |