Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Loop through taxonomy that has a space

Started by Muut Archive 9 years ago · 1 replies · 627 views
9 years ago

I made the mistake of giving a taxonomy a name that has a space and I want to loop through the taxonomy to get the values.

TWIG
{% for tax in page.header.taxonomy.Boat Filter %}
{{ tax ~ ' ' }}
{% endfor %}

How to I get that loop to work? to parse out the space in Boat Filter?

9 years ago
TWIG
{% set taxlist = 'Boat Filters' %}
{% for tax in page.header.taxonomy[taxlist] %}

This worked. Sorry to bother, not sure why I had a hard time with it.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1323 9 years ago
Archive · by Muut Archive, 9 years ago
2 920 9 years ago
Archive · by Muut Archive, 9 years ago
2 4048 9 years ago
Archive · by Muut Archive, 9 years ago
1 2924 9 years ago
Archive · by Muut Archive, 9 years ago
3 1106 9 years ago