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

Display category name in a list of child pages

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

I am running the following code to display a list of child pages. I am trying to put a on the same line.

TWIG
 {% for p in page.children if p != page %} 

<li>{{ p.title }} - {{ p.taxonomy.faq}}</li>
{% endfor %}

I know that the following code will show a tag for the current page:

TWIG
        {% for tag in page.taxonomy.faq %}
        <a href="{{ blog.url }}/tag{{ config.system.param_sep }},{{ tag }}">{{ tag }}</a>
        {{ dump(tag) }}
        {% endfor %}

I am try to combine the two codes so that i can show the name of a child page and its tag, but I am having no luck with the syntax or if its even possible.

any help would be appreciated, i am trying to move from Wordpress to Grav as I think its ace, but this is causing me headaches.

9 years ago

Something like

TWIG
{% for p in page.children if p != page %}
    <li>
        {{ p.title }}
        <br>
        {{ p.taxonomy.faq}}
        <br>
        {% for tag in p.taxonomy.faq %}
            <a href=“{{ blog.url }}/tag{{ config.system.param_sep }},{{ tag }}>{{ tag }}</a>
        {% endfor %}
    </li>
{% endfor %}

?

(didn't test)

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1338 9 years ago
Archive · by Muut Archive, 9 years ago
2 927 9 years ago
Archive · by Muut Archive, 9 years ago
2 4056 9 years ago
Archive · by Muut Archive, 9 years ago
1 2941 9 years ago
Archive · by Muut Archive, 9 years ago
3 1112 9 years ago