djibe
1
Hello,
I use a custom taxonomy specialites
to generate a menu based on this taxonomy.
Config.toml
:
[taxonomies]
specialite = "specialites"
tag = "tags"
But I don’t want the /specialites/*
to be generated.
I read about headless for content but I don’t understand how to achieve this for taxonomy.
Thanks a lot
frjo
2
Why do you want to use a taxonomy but not have the taxonomy pages generated?
In your site config:
[taxonomies]
specialite = "specialites"
tag = "tags"
[[cascade]]
[cascade._build]
list = 'never'
render = 'never'
[cascade._target]
kind = '{taxonomy,term}'
path = '{/specialites,/specialites/**}'
This prevents rendering of the specialites
taxonomy and term pages, and prevents them from being members of any page collection.
The taxonomy object is still populated. Place this in a template to inspect the data structure:
{{ $taxonomyObject := .Site.Taxonomies.specialites }}
<pre>{{ jsonify (dict "indent" " ") $taxonomyObject.Alphabetical }}</pre>
But be aware of this issue:
https://github.com/gohugoio/hugo/issues/10694
If fixed, the cascade
configuration above will prevent population of the taxonomy object as well.
I think @frjo’s question is excellent, and would consider using something other than a taxonomy for your menu thing.
1 Like
djibe
4
Create a menu (ex: Allergology > subitems, Cardiology > subitems) but don’t generate extra dozens of pages for specialites and subitems.
And very likely one day use it as a real taxonomy.
system
Closed
6
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.