Document .Site.Params.mainSections

Fixes #371
This commit is contained in:
Bjørn Erik Pedersen
2018-02-26 10:14:30 +01:00
committed by GitHub
parent 3416ba80d5
commit 31632beeb8
+17
View File
@@ -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/