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: Taxonomy output type setting #273

Closed
estruyf opened this issue Feb 28, 2022 · 5 comments
Closed

Enhancement: Taxonomy output type setting #273

estruyf opened this issue Feb 28, 2022 · 5 comments

Comments

@estruyf
Copy link
Owner

estruyf commented Feb 28, 2022

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!

Originally posted by @johnfuller in #241 (comment)

@cvburgess
Copy link

Just want add a +1 here.

I tried making a taxonomy because I would love to look at posts by their "post_type" but I cant do this without converting post_type to an array with a limit of one and thats not an easy lift with some automation I am using.

@estruyf estruyf added this to To do in 9.4.0 via automation Oct 24, 2023
@estruyf
Copy link
Owner Author

estruyf commented Oct 24, 2023

This functionality will be added by the new singleValueAsString field property which you can set on the tags, categories, and customTaxonomy fields.

By default, it will be set to false, when set to true, when the array has a single value, it will be set as a string.

@estruyf
Copy link
Owner Author

estruyf commented Oct 24, 2023

@cvburgess you are able to give it a try in the latest beta version.

Example field configuration:

{
  "title": "tags",
  "name": "tags",
  "type": "tags",
  "taxonomyLimit": 1,
  "singleValueAsString": true
},
{
  "title": "categories",
  "name": "categories",
  "type": "categories",
  "taxonomyLimit": 1,
  "singleValueAsString": true
},
{
  "title": "Custom taxonomy",
  "name": "customTags",
  "type": "taxonomy",
  "taxonomyId": "customTaxonomy",
  "taxonomyLimit": 1,
  "singleValueAsString": true
}

@cvburgess
Copy link

That worked PERFECTLY for me - thank you SO MUCH!

@estruyf
Copy link
Owner Author

estruyf commented Oct 25, 2023

Happy to hear!

@estruyf estruyf moved this from To do to Done in 9.4.0 Dec 8, 2023
@estruyf estruyf mentioned this issue Dec 12, 2023
@estruyf estruyf closed this as completed Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
9.4.0
Done
Development

No branches or pull requests

2 participants