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.
This commit is contained in:
Bjørn Erik Pedersen 2017-04-17 17:27:26 +02:00
parent a0c0ac2349
commit a947472c6b

View File

@ -2,8 +2,10 @@
<main class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy mid-gray"> <main class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy mid-gray">
{{ .Content }} {{ .Content }}
</main> </main>
{{/* Create a variable to use the same section twice. Note that we've included the date here. */}} {{/* For Hugo 0.20 this will default to the section with the most number of pages. */}}
{{ $section := where .Data.Pages.ByDate.Reverse "Section" "post" }} {{ $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 }} {{ if $section }}
<div class="pa3 pa4-ns w-100 w-70-ns center"> <div class="pa3 pa4-ns w-100 w-70-ns center">