From ae7897c868ae8f0f7b076325e28f4e6f588562a1 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Fri, 5 Mar 2021 17:19:57 +0000 Subject: [PATCH] feat: add Hero support for `design.flip` and new media location Flip reverses the order of the Hero. Can be used with multiple Heros to create the classic alternating feature showcase. --- wowchemy/layouts/partials/widgets/hero.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/wowchemy/layouts/partials/widgets/hero.html b/wowchemy/layouts/partials/widgets/hero.html index b7fd9ffc..4a7f0321 100644 --- a/wowchemy/layouts/partials/widgets/hero.html +++ b/wowchemy/layouts/partials/widgets/hero.html @@ -4,15 +4,15 @@ {{ if $page.Params.hero_media }}
-
+
{{ end }} -

- {{ with $page.Title }}{{ . | markdownify }}{{ end }} -

+ {{ with $page.Title }} +

{{ . | markdownify }}

+ {{ end }} {{ with $page.Content }} -
{{ . }}
+
{{ . }}
{{ end }} {{/* Call-to-action link */}} @@ -58,8 +58,11 @@ {{/* Hero image */}} {{ if $page.Params.hero_media }}
-
- {{ $image := $page.Parent.Resources.GetMatch $page.Params.hero_media }} +
+ {{- $image := ($page.Parent.Resources.ByType "image").GetMatch $page.Params.hero_media -}} + {{- if not $image -}} + {{- $image = resources.Get (path.Join "media" $page.Params.hero_media) -}} + {{- end -}} {{ if $image }} {{ $legacy_img := $image.Resize "400x" }} {{ $img_src := "" }} @@ -76,9 +79,6 @@ {{ $img_src_set = delimit $img_src_set "," }} {{ $page.Title }} - {{ else }} - {{ $media_dir := $.Scratch.Get "media_dir" }} - {{ $page.Title }} {{ end }}