From 6d2e68521a3880a28251df548c85192e53ec4713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 13 Feb 2018 15:45:38 +0100 Subject: [PATCH] Always show the latest showcase item on front page --- .../partials/home-page-sections/showcase.html | 49 +++++++++++-------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/themes/gohugoioTheme/layouts/partials/home-page-sections/showcase.html b/themes/gohugoioTheme/layouts/partials/home-page-sections/showcase.html index ede4c8b9a..774c10e0f 100644 --- a/themes/gohugoioTheme/layouts/partials/home-page-sections/showcase.html +++ b/themes/gohugoioTheme/layouts/partials/home-page-sections/showcase.html @@ -4,26 +4,10 @@
- {{ range $p := first 10 (where .Site.RegularPages "Section" "showcase" | shuffle) }} - {{ $img := (.Resources.ByType "image").GetMatch "*featured*" }} - {{ with $img }} - {{ $big := .Fill "1024x512 top" }} - {{ $small := $big.Resize "512x" }} - - {{with $p.Title}} -
-
- {{.}} → -
-
- {{end}} -
- {{ end }} + {{ $showcasePages := where .Site.RegularPages "Section" "showcase" }} + {{ template "home_showcase_item" (index $showcasePages 0) }} + {{ range $p := first 10 ($showcasePages | after 1 | shuffle) }} + {{template "home_showcase_item" $p }} {{end}}
@@ -32,4 +16,27 @@
{{/* using Flex to make the button show up on the right side */}} See All
- \ No newline at end of file + + + +{{ define "home_showcase_item" }} + {{ $img := (.Resources.ByType "image").GetMatch "*featured*" }} + {{ with $img }} + {{ $big := .Fill "1024x512 top" }} + {{ $small := $big.Resize "512x" }} + + {{with $.Title}} +
+
+ {{.}} → +
+
+ {{end}} +
+ {{ end }} +{{ end }} \ No newline at end of file