Taxonomies don't includes pages in headless bundles?

Hello all.

tl;dr: Is there a way to include the pages in a headless bundle in a taxonomy?


More specifically, at work I’m using a taxonomy for our release notes. The taxonomy terms are the products that each release note pertains to. Each value (i.e. piece of content) in the taxonomy looks something like this:

---
publishDate: 2020-01-08
release-notes:
    - product_name_1
    - product_name_2
    - api
---

The API now supports product_name_1 and product_name_2.

I want the taxonomy terms page and list pages, and I use the taxonomy in other templates in the site. However, I don’t want each release note to have a published page. They’re not necessary for this use case, and I don’t want Hugo to spend the time building them.

… but if I make the bundle with the release note Markdown files headless, that content is no longer included in the taxonomy.

Is there a way to include the pages in a headless bundle in a taxonomy? Is this a reasonable feature request or is there a reason behind the design decision to omit them that I’m not seeing?

Thank you!

If it cannot be a taxonomy, you will have to code the relationship logic yourself.

If you’re bound to have your release-notes values as - product_name_1, - product_name_2 etc… you’ll have to identify that resource based on that. If filename is product_name_1.md for ex I think the following should work:

{{ with .GetPage "/release-notes" }}
  {{ with .Resources.GetMatch "product_name_1" }}
    {{ $release_note_page := . }}
  {{ end }}
{{ end }}

Then it’s easy to wrap your code in a returning partial (making the release note slug an attribute) which will return the $release_note_page whenever called.

Thank you for your reply. I do understand how to do this manually without taxonomies, but the features and abstraction of taxonomies are a good fit for my use case. So what I’m asking is if there’s a way to include the content in a headless bundle with taxonomies specifically, or if there’s a reason why this isn’t the current behavior.

Then I guess you should take a look at the disableKinds config option. It will allow you to “not publish” taxonomy pages (taxonomyTerm and or taxonomy).

I think you get to keep the benefit of the other features of taxonomies, but I am not sure.

Unfortunately, disableKinds only lets you disable taxonomy or taxonomyTerm, but I want the taxonomy page and taxonomy terms pages. What I want to stop rendering are the pages for taxonomy values, i.e. the pieces of content assigned to a taxonomy term.

What I want to stop rendering are the pages for taxonomy values , i.e. the pieces of content assigned to a taxonomy term.

If by “pieces of content assigned to a taxonomy term” you meant its Front Matter then the sentence above would describe the taxonomy kind.

Using the Doc’s example where Actors is a taxonomy and Bruce Willis is a term of the Actors taxonomy:

  • taxonomyTerm is the landing page for a given taxonomy so usually a list of all its terms. For our example, a list of Actors, Bruce Willis among them.
  • taxonomy is the landing page for a term. For our example the page for Bruce Willis. It would display the list of pages (with the Bruce Willis term) and its meta (Front Matter) if the template file allows it.

so disableKinds: ["taxonomy"] should do it… but I might be missing something. Do you have sharable repo?