Hello,
I have been trying to create a listing of tags in posts of a specific category.
This post is the closest I can find in the forums that approximates my need, but it doesn’t actually seem like the solution matches the request?
My goal is to implement a subsetted list of tags.
I do not want a list of ALL tags on the site ( I can do this fairly easily as everyone else can ).
I am trying to obtain a list of all tags associated within a specified category, over all posts in hugo. The sample output would be similar to the OPs example, aka
Food
tomatoes (3)
bread (1)
onions (4)
Music
metal (3)
rock (2)
bread (0)
etc… and then derive counts for the tags. Please notice that I put “bread” in as a tag in both categories. This could happen! The logic should first filter on the category, if there are multiple cateogories, I would like to FIRST filter for category, and then query the number of posts that have the remaining tags.
Both tags and categories are specified in individual post parameters.
I can’t figure out how to reference a returned range as the input for a second range.
{{ range ($.Site.GetPage "taxonomyTerm" "categories").Pages }}
{{ if (eq .Title "food") }}
{{ range ($.Site.GetPage "taxonomyTerm" "tags").Pages }}
<li><a href="{{ .Permalink }}">{{ .Title}}</a> </li>
{{ end }}
{{ end }}
{{ end }}
</ul>
The issue is the second range is referring to global site parameters,
One other side question, is this a hugo question or a golang question? Or is this the same thing? I can repost if a moderator feels this question is more approrpriate somewhere else or as a new thread.
Any help would be GREATLY appreciated, I have been trying to do this for a while!