Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
johnfuller opened this issue Feb 1, 2022 · 6 comments
Closed
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@johnfuller
Copy link

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.

@estruyf estruyf added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Feb 2, 2022
@estruyf
Copy link
Owner

estruyf commented Feb 2, 2022

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.

@estruyf estruyf added this to the 6.1.0 milestone Feb 18, 2022
@estruyf
Copy link
Owner

estruyf commented Feb 18, 2022

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.

@johnfuller
Copy link
Author

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!

@estruyf
Copy link
Owner

estruyf commented Feb 25, 2022

Enhanced the field to show the limit

image

@estruyf
Copy link
Owner

estruyf commented Feb 25, 2022

@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.

@zivbk1
Copy link

zivbk1 commented Feb 28, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants