I've found out you can use
{% set posts = get_taxonomy(kind="posts") %}
to retrieve a taxonomy but I'm clueless how to iterate over the terms of the taxonomy in for example single.html of this taxonomy.
I tried things like the following, but I get:
"Tried to iterate using key value on variable 'posts', but it is missing a key"
{% set posts = get_taxonomy(kind="posts") %}
{% for term in posts %}
<li class="list__item">
<a href="{{ term.permalink }}">
{{ term.name }}
</a>
</li>
{% endfor %}
get_taxonomy
returns a struct with keys items
& kind
. You can debug using:
{% set posts = get_taxonomy(kind="posts") %}
<code>{{ posts.kind | json_encode(pretty=true) }}
{{ posts.items | json_encode(pretty=true) }}</code>
kind
seems to have TaxonomyConfig
structure and each element in items
seems to have TaxonomyTerm
structure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With