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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

List tags and URLs inside

Started by pablo.luis.franco 7 years ago · 1 replies · 487 views
7 years ago

I want to list first all children tags of a parent page, and after that list all children pages of those tags. I have achieved to list children pages of a given tag:

TWIG
{% for p in taxonomy.findTaxonomy({'tag':'Agonista adrenérgico'}) %}
[{{ p.title }}]({{p.url}})
{% endfor %}

But I want to automatically show me a list of tags and after each tag the children with that tag. I have tried this, but it doesn't work:

TWIG
{% for p in page.children.order('date', 'asc') if p != page %}
<span style="background-color: #ffcc99; font-size: 8pt;">{{ taxonomy.getTaxonomyItemKeys('taxonomy.tag') }}</span> [{{ p.title }}]({{p.url}})
{% endfor %}

Thanks in advance!

7 years ago

@pabloluih Would you mind sharing an image or drawing of what you have in mind? I'm not sure I understand...

👍 1

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 85 13 hours ago
General · by pamtbaau, 18 hours ago
1 60 18 hours ago
General · by Andy Miller, 1 day ago
0 47 1 day ago
General · by Marcel, 12 months ago
6 350 5 days ago
General · by Duc , 6 days ago
3 44 5 days ago