diff options
author | Oscar Najera <hi@oscarnajera.com> | 2023-10-20 16:06:53 +0200 |
---|---|---|
committer | Oscar Najera <hi@oscarnajera.com> | 2023-10-20 16:32:48 +0200 |
commit | 19b9131073d1da80cc0193af397d5a1ab267f45d (patch) | |
tree | 6b248ec4b9a279c8d381cf5b2000c1f532652e82 /layouts/partials/leading_image.html | |
parent | 0b60f218c1cf0aac57473e0643aedfad1698b5e4 (diff) | |
download | hugo-minimalist-theme-19b9131073d1da80cc0193af397d5a1ab267f45d.tar.gz hugo-minimalist-theme-19b9131073d1da80cc0193af397d5a1ab267f45d.tar.bz2 hugo-minimalist-theme-19b9131073d1da80cc0193af397d5a1ab267f45d.zip |
Project single page
Diffstat (limited to 'layouts/partials/leading_image.html')
-rw-r--r-- | layouts/partials/leading_image.html | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/layouts/partials/leading_image.html b/layouts/partials/leading_image.html new file mode 100644 index 0000000..ac528d3 --- /dev/null +++ b/layouts/partials/leading_image.html @@ -0,0 +1,30 @@ +{{ $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="tc"> + <div class="relative dib"> + <img + src="{{ if ne .MediaType.SubType "svg" }} + {{ $image := .Fit (default "768x400" $.Params.image_size) }} + {{ $image.RelPermalink }} + {{ else }} + {{ $image.RelPermalink }} + {{ end }}" + class="ma0" + alt="{{ .Title }}" + /> + {{ with $.Params.caption }} + <a + href="{{ .url }}" + class="link near-white db absolute bottom-0 right-0 pa2 bg-black-30 br2" + > + {{ .text }} + </a> + {{ end }} + </div> + </div> +{{ end }} |