working example of customTaxonomy #195

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

Can you provide a working example of customTaxonomy in use? The example in the docs (https://frontmatter.codes/docs/content-types#custom-taxonomy-field) is not functioning correctly when used verbatim. It appears to link a taxonomyId of 'custom taxonomy' with a name property of a "taxonomy field" (rather than the id property?); there's also no sense of where one should define the custom fields.

This, for example, does not work:

  "frontMatter.taxonomy.customTaxonomy": [
    {
      "title": "category singular",
      "name": "category",
      "type": "taxonomy",
      "taxonomyId": "categorySingular"
    }
  ]

I assume I just don't understand the expected syntax for settings.json.

Thanks!

Can you provide a working example of `customTaxonomy` in use? The example in the docs (https://frontmatter.codes/docs/content-types#custom-taxonomy-field) is not functioning correctly when used verbatim. It appears to link a `taxonomyId` of 'custom taxonomy' with a `name` property of a "taxonomy field" (rather than the `id` property?); there's also no sense of where one should define the custom fields. This, for example, does not work: ``` "frontMatter.taxonomy.customTaxonomy": [ { "title": "category singular", "name": "category", "type": "taxonomy", "taxonomyId": "categorySingular" } ] ``` I assume I just don't understand the expected syntax for `settings.json`. Thanks! <!-- github-sync-id:1130596998 -->
adam closed this issue 2026-10-05 02:32:51 +02:00
Author
Owner

Hi @grahampcharles it seems the provided sample is incorrect. Sorry for that.

The taxonomyId value needed to be customTaxonomy as that matches the custom taxonomy its id.

Hi @grahampcharles it seems the provided sample is incorrect. Sorry for that. The `taxonomyId` value needed to be `customTaxonomy` as that matches the custom taxonomy its id. <!-- github-comment-id:1035271015 -->
Author
Owner

Great! And it goes in settings.json?

Great! And it goes in `settings.json`? <!-- github-comment-id:1035279710 -->
Author
Owner

An example:

{
	"frontMatter.taxonomy.contentTypes": [
    {
      "name": "page",
      "fields": [
        {
          "title": "Custom taxonomy",
          "name": "customTags",
          "type": "taxonomy",
          "taxonomyId": "yourCustomTaxId"
        },
        ...
      ]
    }
  ],
  "frontMatter.taxonomy.customTaxonomy": [
    {
      "id": "yourCustomTaxId",
      "options": [
        "Option 1",
        "Option 2",
        "Option 3"
      ]
    }
  ]
}
An example: ```JSON { "frontMatter.taxonomy.contentTypes": [ { "name": "page", "fields": [ { "title": "Custom taxonomy", "name": "customTags", "type": "taxonomy", "taxonomyId": "yourCustomTaxId" }, ... ] } ], "frontMatter.taxonomy.customTaxonomy": [ { "id": "yourCustomTaxId", "options": [ "Option 1", "Option 2", "Option 3" ] } ] } ``` <!-- github-comment-id:1035281642 -->
Author
Owner

Great! And it goes in settings.json?

Yes, this goes in the settings.json or in the frontmatter.json file.

> Great! And it goes in `settings.json`? Yes, this goes in the `settings.json` or in the `frontmatter.json` file. <!-- github-comment-id:1035282838 -->
Author
Owner

Ah, brilliant -- thanks! I wasn't understanding that the "frontMatter.taxonomy.contentTypes" setting was related.

Thanks again,

Graham

Ah, brilliant -- thanks! I wasn't understanding that the `"frontMatter.taxonomy.contentTypes"` setting was related. Thanks again, Graham <!-- github-comment-id:1035285961 -->
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#195