I am trying to list tags on a page on digital.gov that is not using the layouts/_default/terms.html template.
I am trying to Use .Site.Taxonomies Outside of Taxonomy Templates and have that it also return data that is in our tag.yml file
Each tag should have the:
- id (slug)
- display_name
- count
- summary (this is additional data)
This page in the docs helped me to call the taxonomy I needed outside the terms.html page, but I am unclear on how I can access the tag data that we have in our tag.yml data file.
It looks like $.Site.Taxonomies.tag does not have the tag data, just the post/page data associated with each tag. Is that correct?
Here is what I have tried so far…
{{/* Ranges through all the tag data — tag name + posts */}}
{{- range $tag_name, $tag_posts := index $.Site.Taxonomies.tag -}}
{{/* $tag_data == trying to look up the data for a tag,
but unfortunately, I only have the display_name, not the key */}}
{{- $tag_data := (index $.Site.Data.tag $tag_name) -}}
{{/* Tag Name | # of posts associated with that tag | tag display_name */}}
<p>{{ $tag_name }} | {{ $tag_posts.Count }} | {{ $tag_data.display_name }} | (tag summary)</p>
{{- end -}}
Any advice?
