Template functions · Lists

filter

Keep the items whose property matches a regular expression.

filter "property" "regex" list

Takes the same properties as sort and a Go regular expression. Anchor the pattern with ^ and $ for an exact match.

Example

{{ $docs := sources "RelPath" "docs/*" }}
{{ range filter "Meta.section" "^Guides$" $docs }}
  <li>{{ .Meta.title }}</li>
{{ end }}

data sources sort limit offset select paginate pages page path hash json contains html js css

Edit this page · Last updated 2026-11-20