Custom taxonomies named after reserved words like outputs

I am well aware that this is just asking for troubles: I would like to create two taxonomies called “input[s]” and “output[s]”, however, assigning terms to “outputs” in front matter is not possible as “outputs” is already in use for output formats.

Is there some kind of prefix that I could add in such cases or am I required to choose a different name?

How do I get the originally intended taxonomy directories: is setting url (and perhaps title) in a _index.md sufficient?

Related thread (I had not thought of the right keywords before): Reserved words in Hugo?

If I were you I would use a different word. The alternative is to do something like this…

hugo.toml

[taxonomies]
output = '_outputs'

[permalinks.term]
_outputs = '/outputs/:slug'

[permalinks.taxonomy]
_outputs = '/outputs'

content/_outputs/_index.md

+++
title = 'Outputs'
date = 2024-10-29T07:30:22-07:00
draft = false
+++

content/posts/post-1.md

+++
title = 'Post 1'
date = 2023-01-01T00:00:00-00:00
draft = false
_outputs = ['a']
+++
1 Like

Thanks for reminding me of URL patterns, which appear to be a good backup solution. :pray:t2:

Unfortunately, “input” and “output” are defined for ages in a technical document so I still need to come up with a non-confusing alternative…

Would the singular form of the noun work?

[taxonomies]
output = 'output'
1 Like

Oh, that’s possible?! It just breaks .Data.Plural, right? I certainly could live with that…

Well, it doesn’t break it, but the return value will be singular.

1 Like

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