# Nested taxonomies

**URL:** <https://discourse.gohugo.io/t/nested-taxonomies/48578>\
**Category:** support\
**Created:** [February 29, 2024, 2:34pm UTC](https://discourse.gohugo.io/t/nested-taxonomies/48578 "2024-02-29T14:34:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vistad](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/vistad/32/20509_2.png) [@vistad](https://discourse.gohugo.io/u/vistad)\
**Post date:** [February 29, 2024, 2:34pm UTC](https://discourse.gohugo.io/t/nested-taxonomies/48578/1 "2024-02-29T14:34:16Z")

</div>

E.g. I have “categories” and “tags” in my taxonomies. Is it possible to range all tags that belong to a certain category?  
Should both be in taxonomies? Or if I have only “categories” in taxonomies, can I within a certain category range all documents that share a common tag?

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [February 29, 2024, 2:46pm UTC](https://discourse.gohugo.io/t/nested-taxonomies/48578/2 "2024-02-29T14:46:53Z")

</div>

You have tags within a category, and category is a taxonomy?

---

<div class="post-metadata">

**Author:** ![panchtatvam](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/panchtatvam/32/20935_2.png) [@panchtatvam](https://discourse.gohugo.io/u/panchtatvam)\
**Post date:** [February 29, 2024, 2:53pm UTC](https://discourse.gohugo.io/t/nested-taxonomies/48578/3 "2024-02-29T14:53:50Z")

</div>

How will you define the connection between tags and categories ?

Say you have a category of eductional streams like _science_, _politics_, _language_ and tags as subjects like _physics_, _biology_, _chemistry_, _international-relations_, _hindi_.

You know that subjects like _physics_ , _chemistry_ and _biology_ tags are related to _science_ category of eductional stream, but how do you propose to make this connection in the frontmatter ?

PS: I suppose you can mark the tags and categories with a prefix like _0\_science_ , _0\_physics_ and so on. That can tell the code that they are related. You can then do string manipulation to match tags and categories that have this prefix.

---

<div class="post-metadata">

**Author:** ![vistad](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/vistad/32/20509_2.png) [@vistad](https://discourse.gohugo.io/u/vistad)\
**Post date:** [February 29, 2024, 3:18pm UTC](https://discourse.gohugo.io/t/nested-taxonomies/48578/4 "2024-02-29T15:18:26Z")

</div>

Say, my info.md files have a few categories - VEHICLES etc. Is it possible to range all documents of this category?

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [February 29, 2024, 3:22pm UTC](https://discourse.gohugo.io/t/nested-taxonomies/48578/5 "2024-02-29T15:22:17Z")

</div>

[https://gohugo.io/functions/collections/where/#intersection-comparison](https://gohugo.io/functions/collections/where/#intersection-comparison)

---

<div class="post-metadata">

**Author:** ![vistad](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/vistad/32/20509_2.png) [@vistad](https://discourse.gohugo.io/u/vistad)\
**Post date:** [February 29, 2024, 4:00pm UTC](https://discourse.gohugo.io/t/nested-taxonomies/48578/6 "2024-02-29T16:00:32Z")

</div>

Thank you Joe! It works!

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [March 2, 2024, 4:00pm UTC](https://discourse.gohugo.io/t/nested-taxonomies/48578/7 "2024-03-02T16:00:50Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
