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

Category list of child pages

Started by Dmitry 6 years ago · 1 replies · 630 views
6 years ago

Hello! I have a list of pages:
{% set items = page.evaluate({'@page.children': '/items'}) %}

How can I get a list of categories for these pages?

6 years ago

My decision now:

TWIG
{% set items = page.evaluate({'@page.children': '/items'}) %}
{% set catlist = [] %}

{% for item in items %}
    {% for cat in item.taxonomy.category %}
        {% if cat not in catlist %}
            {% set catlist = catlist|merge([cat]) %}
        {% endif %}
    {% endfor %}
{% endfor %}

Suggested topics

Topic Participants Replies Views Activity
General · by Hanns Mattes, 3 weeks ago
1 268 3 weeks ago
General · by Andy Miller, 3 weeks ago
0 196 3 weeks ago
General · by Jerry Hunt, 3 weeks ago
2 331 3 weeks ago
General · by pamtbaau, 3 weeks ago
1 253 3 weeks ago
General · by Andy Miller, 3 weeks ago
0 225 3 weeks ago