Enhancement: Taxonomy output type setting #217

Closed
opened 2026-10-05 02:34:11 +02:00 by adam · 5 comments
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!

Originally posted by @johnfuller in https://github.com/estruyf/vscode-front-matter/issues/241#issuecomment-1046998565

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 https://github.com/estruyf/vscode-front-matter/issues/241#issuecomment-1046998565_ <!-- github-sync-id:1154285391 -->
adam closed this issue 2026-10-05 02:34:11 +02:00
Author
Owner

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.

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. <!-- github-comment-id:1776208556 -->
Author
Owner

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.

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`. <!-- github-comment-id:1777181511 -->
Author
Owner

@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 you are able to give it a try in the latest beta version. Example field configuration: ```json { "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 } ``` <!-- github-comment-id:1777371842 -->
Author
Owner

That worked PERFECTLY for me - thank you SO MUCH!

That worked PERFECTLY for me - thank you SO MUCH! <!-- github-comment-id:1777733282 -->
Author
Owner

Happy to hear!

Happy to hear! <!-- github-comment-id:1778628565 -->
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#217