Hi all,
I just switched from WordPress+Timber (WP’s port of twig) to Grav, which I find amazing.
I have some issues translating my knowledge of twig from Timber to Grav.
For example, I used to have a generic partial to deal with taxonomies in posts:
{% if post.terms( taxo ) %}
{{ sufx }}
{% endif %}
{% for term in post.terms( taxo ) %}
{{term.name}}
{% if loop.last %}
{% else %}
-
{% endif %}
{% endfor %}
So that I could easily display the taxonomy in a post just by writing:
{% include 'partials/gen-taxo.twig' with {'taxo': 'my-taxonomy', 'sufx': 'my-suffix'} %}
I am trying to do the same in Grav. I expected this to work:
{% if page.header.taxonomy(taxo) %}
{{ sufx }}
{% endif %}
{% for term in page.header.taxonomy( taxo ) %}
{{ term }}
{% if loop.last %}
{% else %}
-
{% endif %}
{% endfor %}
I know the variables taxo and suffx are well passed to the twig template because I am able to display them through the include.
But it does not.
Any help much appreciated.
Stephen