Enhancement: Setting to limit taxonomy options to single selection #192

Closed
opened 2026-10-05 02:32:39 +02:00 by adam · 6 comments
Owner

With choices, you have a setting to allow multiple selections. I don't know the intent behind the design of custom taxonomies, but I see this as essentially creating reusable choices fields. Constraining choices to a single selection allows for setting the front matter field to a string or an array of strings. Taxonomies should give you similar control over the resulting field type.

With choices, you have a setting to allow multiple selections. I don't know the intent behind the design of custom taxonomies, but I see this as essentially creating reusable choices fields. Constraining choices to a single selection allows for setting the front matter field to a string or an array of strings. Taxonomies should give you similar control over the resulting field type. <!-- github-sync-id:1120643633 -->
adam closed this issue 2026-10-05 02:32:39 +02:00
Author
Owner

The difference between custom taxonomy fields and choice fields is that taxonomy fields allow you to add new values and allow to store these. So you could start with an empty list, and let it fill up over time.

The limit on the taxonomy fields is a great new enhancement.

The difference between custom taxonomy fields and choice fields is that taxonomy fields allow you to add new values and allow to store these. So you could start with an empty list, and let it fill up over time. The limit on the taxonomy fields is a great new enhancement. <!-- github-comment-id:1027670887 -->
Author
Owner

You will now be able to specify the taxonomyLimit field property on your tags, category, and custom taxonomy fields in order to limit the number of options you can select.

You will now be able to specify the `taxonomyLimit` field property on your tags, category, and custom taxonomy fields in order to limit the number of options you can select. <!-- github-comment-id:1043817768 -->
Author
Owner

This is a great enhancement, as a CMS requires user inputs to match rules in the code. As a further enhancement, it may be beneficial to allow setting the type to a string or an array. Because this is a developer concern, it may be good enough to assume that a limit of a single selection would be a string. A markdown front-matter structure has limited data types available, and I believe that enforcing a data type would make this more robust. Target parsers will output data differently based on these types. Thanks!

This is a great enhancement, as a CMS requires user inputs to match rules in the code. As a further enhancement, it may be beneficial to allow setting the type to a string or an array. Because this is a developer concern, it may be good enough to assume that a limit of a single selection would be a string. A markdown front-matter structure has limited data types available, and I believe that enforcing a data type would make this more robust. Target parsers will output data differently based on these types. Thanks! <!-- github-comment-id:1046998565 -->
Author
Owner

Enhanced the field to show the limit

image

Enhanced the field to show the limit ![image](https://user-images.githubusercontent.com/2900833/155675173-6f44d4ea-aa34-400a-984f-460befab9a81.png) <!-- github-comment-id:1050611891 -->
Author
Owner

@johnfuller the further enhancement on the taxonomy field makes sense indeed, I'm not sure if the right way to output a string when the limit is set to 1 is the best option here. Maybe an extra setting is required to specify its type.

@johnfuller the further enhancement on the taxonomy field makes sense indeed, I'm not sure if the right way to output a `string` when the limit is set to `1` is the best option here. Maybe an extra setting is required to specify its type. <!-- github-comment-id:1050614430 -->
Author
Owner

It would break my code if an array data type output a string instead of an array with a single element.

It would break my code if an array data type output a string instead of an array with a single element. <!-- github-comment-id:1054446778 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#192