Do taxonomies support front-matter: cascade, outputs, and _build options?

I have two custom taxonomies and have enabled JSON and HTML output for both taxonomy and term.

config.toml

[outputs]
    home     = ["html"]
    section  = ["html"]
    page     = ["html"]
    taxonomy = ["html","json"]
    term     = ["html","json"]

For taxonomy-A, I want to disable the JSON output and not render the taxonomy list page.
For taxonomy-B, I want to disable HTML output.

I have tried every combination (seemingly) of outputs and _build options, but cannot accomplish my goal.

In taxonomy-A/_index.md:

---
title: Taxonomy-A
cascade:
  outputs:
    taxonomy: [html]
    term: [html]
_build:
    list: never
    render: never
---

In taxonomy-B/_index.md:

---
title: Taxonomy-B
outputs:
  section: [json]
  page: [json]
  taxonomy: [json]
  term: [json]
cascade:
  outputs:
    section: [json]
    page: [json]
    taxonomy: [json]
    term: [json]
---

This doesn’t seem to work. I realize that the cascade might not have an effect because the term pages are generated dynamically.

How can I set different outputs and _build options for each taxonomy (and all terms within)?

First, it would help to see your repo as per asking for help

Second, please clarify what you mean by “doesn’t work”. What are the results you get vs the results you wanted?

Yes, I reviewed the guide for asking for help. I’ve read the docs thoroughly and delved deep into the forum posts to clarify my answer and have not been able. I’m not asking for help to troubleshoot my repo (which is private)–I’m asking for someone to clarify a feature that I’m using in a way that might be unconventional.

Specifically my question is: Is it possible to set different outputs and _build options for the terms within each taxonomy? I can do this for each taxonomy by creating taxonomyA/_index.md and taxonomyB/_index.md, but it’s not clear to me how to do this for the taxonomy terms (without creating a stub file for every taxonomy term I use).

You can also set cascade in your config.toml or config.yaml:

That may help. When using the config file cascade, using a _target path is likely useful for you as well.

2 Likes

@cshoredaniel Kind sir, you just made my week! Thank you.

I did not know about _target. Using that in the main config worked.

For those interested, here is my config:

[outputs]
    home = ['HTML']
    section = ['HTML']
    page = ['HTML']
    taxonomy = ['HTML','JSON']
    term = ['HTML', 'JSON']

[[cascade]]
[cascade._target]
    path = '/tags/**'
    [[cascade]]
        outputs = ['HTML']
[cascade._target]
    path = '/categories/**'
    [[cascade]]
        outputs = ['JSON']
1 Like

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