From a947472c6bd05db7a3bb625ea66b54aa9ca4d442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 17 Apr 2017 17:27:26 +0200 Subject: [PATCH] Use Site.Params.mainSections to select pages on home page This helps with theme portability. Also use Site.RegularPages in its default sort, as this is probably what most people want. --- layouts/index.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/layouts/index.html b/layouts/index.html index 3da9bfe..69e5529 100755 --- a/layouts/index.html +++ b/layouts/index.html @@ -2,8 +2,10 @@
{{ .Content }}
- {{/* Create a variable to use the same section twice. Note that we've included the date here. */}} - {{ $section := where .Data.Pages.ByDate.Reverse "Section" "post" }} + {{/* For Hugo 0.20 this will default to the section with the most number of pages. */}} + {{ $mainSections := .Site.Params.mainSections | default (slice "post") }} + {{/* Create a variable to use the same section twice. */}} + {{ $section := where .Site.RegularPages "Section" "in" $mainSections }} {{ if $section }}