Update layout to use Hugo Image Processing.

Created shortcode rimg that uses the srcset attribute to display responsive images.
This commit is contained in:
Patrick Magauran 2020-11-26 13:59:15 -05:00
parent da036923f3
commit 3a77d4c703
10 changed files with 218 additions and 20 deletions

View file

@ -1,5 +1,15 @@
{{ $heroImage:= "/assets/images/default-hero.jpg"}}
{{ if .Params.hero }}
{{ $heroImage = .Params.hero }}
{{ $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 }}
{{ return $heroImage }}