Issue: Only 1 dimension allowed in contentTypes #157

Closed
opened 2026-10-05 02:30:24 +02:00 by adam · 7 comments
Owner

Describe the bug
In case a Frontmatter subentry has to be taken as name of a custom contentType, it won't work. For example:

FrontMatter

---
title: xxx
subtitle: yyy
photo:
  file: my-photo.jpg
  name: My Photo
---

Setting

"frontMatter.taxonomy.contentTypes": [
	"name": "default",
    "previewPath": "/static/photos/",
	"fields": [
		...
        {
          "title": "Article preview",
          "name": "photo.file",
          "type": "image"
        }
	]
]

Expected behavior
Subentries should be noted if they are separated by a period.

**Describe the bug** In case a Frontmatter subentry has to be taken as name of a custom contentType, it won't work. For example: **FrontMatter** ``` --- title: xxx subtitle: yyy photo: file: my-photo.jpg name: My Photo --- ``` **Setting** ``` "frontMatter.taxonomy.contentTypes": [ "name": "default", "previewPath": "/static/photos/", "fields": [ ... { "title": "Article preview", "name": "photo.file", "type": "image" } ] ] ``` **Expected behavior** Subentries should be noted if they are separated by a period. <!-- github-sync-id:1066183665 -->
adam closed this issue 2026-10-05 02:30:24 +02:00
Author
Owner

Thanks @kristofzerbe, this is currently a limitation, but is great to add support in a future version!.

Thanks @kristofzerbe, this is currently a limitation, but is great to add support in a future version!. <!-- github-comment-id:981758371 -->
Author
Owner

I think this would also help resolve #176

I think this would also help resolve #176 <!-- github-comment-id:982751422 -->
Author
Owner

The first integration of the multi-dimensional content-type field support has been added.

In the content type, you can now define it as follows:

{
  "frontMatter.taxonomy.contentTypes": [
    {
      "name": "multi-dimensional",
      "pageBundle": false,
      "fields": [
        ...
        {
          "title": "Photo",
          "type": "fields",
          "name": "photo",
          "fields": [
            {
              "title": "Title",
              "name": "title",
              "type": "string",
              "default": "default title"
            },
            {
              "title": "URL",
              "name": "url",
              "type": "string"
            }
          ]
        }
      ]
    }
  ]
}

When creating the content, it will automatically include the defined fields. From the metadata section in the Front Matter panel, you can perform changes to your article its front matter.

image

Feel free to test it out in the latest beta version.

The first integration of the multi-dimensional content-type field support has been added. In the content type, you can now define it as follows: ```json { "frontMatter.taxonomy.contentTypes": [ { "name": "multi-dimensional", "pageBundle": false, "fields": [ ... { "title": "Photo", "type": "fields", "name": "photo", "fields": [ { "title": "Title", "name": "title", "type": "string", "default": "default title" }, { "title": "URL", "name": "url", "type": "string" } ] } ] } ] } ``` When creating the content, it will automatically include the defined fields. From the metadata section in the Front Matter panel, you can perform changes to your article its front matter. ![image](https://user-images.githubusercontent.com/2900833/148933516-0276a060-e4ed-4d89-8f69-2a099b898bb0.png) Feel free to test it out in the latest beta version. <!-- github-comment-id:1009867886 -->
Author
Owner

This is excellent!

This is excellent! <!-- github-comment-id:1010147848 -->
Author
Owner

Thanks @zivbk1 for verifying!

@kristofzerbe would you mind giving it a try?

Thanks @zivbk1 for verifying! @kristofzerbe would you mind giving it a try? <!-- github-comment-id:1010739778 -->
Author
Owner

One small change, the object type has been changed to fields. Additionally, support for taxonomy fields has been added + image fields.

Screenshot 2022-01-12 at 11 25 04

One small change, the `object` type has been changed to `fields`. Additionally, support for taxonomy fields has been added + image fields. ![Screenshot 2022-01-12 at 11 25 04](https://user-images.githubusercontent.com/2900833/149122827-a89ff763-1a86-4fb7-9c1a-7244413e8a4e.png) <!-- github-comment-id:1010890140 -->
Author
Owner

Thanks @zivbk1 for verifying!

@kristofzerbe would you mind giving it a try?

Custom subfields are working great. Thanks a lot. :)

Only thing is, that I expect in the frontmatter of my posts the file name only (f.e. my-image.png), because I have multiple image folders according to different device classes (mobile, tablet, normal). I tried now to create an image field called preview with a default value like this, to show the small (mobile) image as preview and use it also as preview image in the dashboard:

{
  "title": "Photograph",
  "name": "photograph",
  "type": "fields",
  "fields": [
    {
      "title": "File",
      "name": "file",
      "type": "string",
      "single": true
    },
    {
      "title": "Preview",
      "type": "image",
      "isPreviewImage": true,
      "default": "/static/photos/mobile/{{file}}"
    }
  ]    
}

Maybe the default type works different as I think or I can't use the variable file is this context...

Greets
Kristof

> Thanks @zivbk1 for verifying! > > @kristofzerbe would you mind giving it a try? Custom subfields are working great. Thanks a lot. :) Only thing is, that I expect in the frontmatter of my posts the **file name only** (f.e. ``my-image.png``), because I have multiple image folders according to different device classes (mobile, tablet, normal). I tried now to create an ``image`` field called **preview** with a default value like this, to show the small (mobile) image as preview and use it also as preview image in the dashboard: ``` { "title": "Photograph", "name": "photograph", "type": "fields", "fields": [ { "title": "File", "name": "file", "type": "string", "single": true }, { "title": "Preview", "type": "image", "isPreviewImage": true, "default": "/static/photos/mobile/{{file}}" } ] } ``` Maybe the ``default`` type works different as I think or I can't use the variable ``file`` is this context... Greets Kristof <!-- github-comment-id:1040487699 -->
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#157