Empty section condition?

You can filter them out by setting a custom parameter on the _index.md of these sections.

Something like this would do. (This is in YAML you can figure out the TOML)

exclude: true

And then simply place the following in the relevant template to exclude these sections from your navigation.

{{ $sections := .Site.GetPage "section" .Section }}
{{ range where $sections "Params.exclude" "ne" "true"  }}

EDIT
I changed the above snippet because what I posted originally is meant for Nested Sections.

1 Like