I’m the developer of Hugo-Vitae and are stuck at a problem with the taxonomies and terms. At the moment the taxonomy path is fix on /tags/ but I want to be able to show all created taxonomies and there terms under the content. The single.html part for this looks like this at the moment:
singel.html
<div class="tags">
{{ if ne .Type "page" }}
{{ range .Params.tags }}
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}
{{ end }}
</div>
Let’s say I have some posts that have tags and others that have themes, then it should show every term no matter of its taxonomy under the content in the single.html. Afterwards I want be able to make specific menu entries for the taxonomies where only the terms to the taxonomy are listed. Like tags and `themes.
I want it to be so flexible so the users can better decide which name there taxonomies have.
You want to go through site.Taxonomies. It will list all taxonomies. Key is the taxononomy name, value is a slice of terms.
so on your page single.html you should:
{{ range $taxonomy, $terms := site.Taxonomies }}
{{ with index $.Params $taxonomy }}
<h2>{{ $taxonomy | humanize }}</h2>
{{ range . }}
[... build your term's link here]
{{ end }}
{{ end }}
{{ end }}
This has not been tested. Might need some tweaking if it fails at first try but you get the gist.
thank you for this first hint. I tried a bit with it and I have no clue what is happening.
I tried this alone but this gives not even an output:
{{ range $taxonomy := site.Taxonomies }}
{{ with index $.Params . }}
<h2>{{ $taxonomy | humanize }}</h2>
{{ end }}
{{ end }}
When I try:
{{ range $taxonomy := site.Taxonomies }}
<h2>{{ $taxonomy }}</h2>
{{ end }}
I get at least this:
Summary
map[themes-guide:[WeightedPage(0,"Markdown Syntax Guide")]]
map[css:[WeightedPage(0,"Markdown Syntax Guide")]
emoji:[WeightedPage(0,"Emoji Support")]
html:[WeightedPage(0,"Markdown Syntax Guide")]
markdown:[WeightedPage(0,"Markdown Syntax Guide") WeightedPage(0,"Placeholder Text")]
primer:[WeightedPage(0,"Primer: When You Have Too Much to Do")]
privacy:[WeightedPage(0,"Rich Content")]
procrastinating:[WeightedPage(0,"How I Learned to Stop Procrastinating, & Love Letting Go")]
shortcodes:[WeightedPage(0,"Rich Content")]
space:[WeightedPage(0,"Fearlessness: How to Stop Running from Space")] text:[WeightedPage(0,"Placeholder Text")] themes:[WeightedPage(0,"Markdown Syntax Guide")] todo:[WeightedPage(0,"Primer: When You Have Too Much to Do")]]
I’m not really good with golang maybe you can help me a bit further?
I also don’t know what the term link should look like.