From 31632beeb820c33aa723783f25570451b398617f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 26 Feb 2018 10:14:30 +0100 Subject: [PATCH] Document .Site.Params.mainSections Fixes #371 --- content/functions/where.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/content/functions/where.md b/content/functions/where.md index 262fd6ebc..574fef2df 100644 --- a/content/functions/where.md +++ b/content/functions/where.md @@ -134,4 +134,21 @@ Only the following operators are available for `nil` {{ end }} ``` +## Portable `where` filters + +This is especially important for themes, but to list the most relevant pages on the front page or similar, you can use `.Site.Params.mainSections` list. + +This will, by default, list pages from the _section with the most pages_. + +```html +{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} +``` + +The user can override the default in `config.toml`: + +```toml +[params] +mainSections = ["blog", "docs"] +``` + [intersect]: /functions/intersect/