hugo-toha/layouts/partials/helpers/get-hero.html
Patrick Magauran 49cb1042ea Update layout to use Hugo Image Processing.
Created shortcode rimg that uses the srcset attribute to display responsive images.
2021-01-01 02:49:21 +06:00

15 lines
397 B
HTML

{{ $heroImage := .Page.Resources.GetMatch "hero.{jpg,png}"}}
{{ .Scratch.Set "heroScratch" $heroImage }}
{{ if not $heroImage }}
{{ $heroImage:= resources.Get "default-hero.jpg"}}
{{ .Scratch.Set "heroScratch" $heroImage }}
{{ end }}
{{ $heroImage := .Scratch.Get "heroScratch" }}
{{ if $heroImage }}
{{ $heroImage := $heroImage.Resize "148x" }}
{{ return $heroImage.RelPermalink }}
{{ end }}