I made a search page that renders what tag was searched/linked to like /search/tag:foo
Without using the taxonomylist plugin, how can I get the list of tags used for all child pages of /01.home/ or even better the entire site including all pages with taxonomy in frontmatter.
TAGS:
{% for tag in page.taxonomy.tag %}
<a href="{{ url.base }}/search/tag:{{ tag }}">{{ tag }}</a> +
{% endfor %}
I’ve looked through learn.grav and twig docs and even on a few other forums but can’t figure this out.
instead of page.taxonomy.tag I’ve tried just taxonomy and then taxonomy.taxonomy.tag but none of those are returning back whatever the TWIG FOR loop is expecting. I’m new to PHP and TWIG templating.
I would think something like site.taxonomy.tag would return tags for the entire site vs page.taxonomy.tag but that doesn’t work either
The best way to find out the content of a variable is through {{ dump() }}, for example {{ dump(page.taxonomy) }} will show you the content of it in the debug bar.
If what you want is the list of tags listed in the entire site, why not use the taxonomylist plugin? Do you need something different? You could start with forking it, and edit it to get what you need?
thanks. I did dump as see the json object it produces, I was just expecting to find a variable like site.taxonomy.tag like there is for page.taxonomy.tag that make’s consuming that info/data as easy. the taxonomylist plugin is fine and I’m using it now but the formatting is not what I need and if there were a variable like site.x.x available I could just swap out the object in the for loop I’m already using on pages to list our the tags associated with that page.