Enhancement: Better support for using block fields in block fields #293

Closed
opened 2026-10-05 02:38:20 +02:00 by adam · 1 comment
Owner

Currently, it is not possible to create the following structure:

ingredients:
  - wet:
    - water:
    	quantity: 1
    	unit: cup
  - dry:
    - flour:
    	quantity: 10
    	unit: oz
Currently, it is not possible to create the following structure: ``` ingredients: - wet: - water: quantity: 1 unit: cup - dry: - flour: quantity: 10 unit: oz ``` <!-- github-sync-id:1288316404 -->
adam closed this issue 2026-10-05 02:38:20 +02:00
Author
Owner

In order to support this, changes have been made to the block renderer.

image

The field configuration looks as follows:

{
  "frontMatter.taxonomy.contentTypes": [
    {
      "name": "Recipe",
      "pageBundle": false,
      "previewPath": null,
      "fields": [
        {
          "title": "Ingredients",
          "name": "ingredients",
          "type": "block",
          "fieldGroup": ["wet", "dry"]
        }
      ]
    }
  ],
  "frontMatter.taxonomy.fieldGroups": [
    {
      "id": "wet",
      "fields": [
        {
          "title": "Wet",
          "name": "wet",
          "type": "block",
          "fieldGroup": ["water", "oil"]
        }
      ]
    },
    {
      "id": "water",
      "fields": [
        {
          "title": "Water",
          "name": "water",
          "type": "fields",
          "fields": [
            {
              "title": "Quantity",
              "name": "quantity",
              "type": "string",
              "single": true
            },
            {
              "title": "Unit",
              "name": "unit",
              "type": "string",
              "single": true
            }
          ]
        }
      ]
    },
    ...
  ]
}

Output looks as follows in front matter:

ingredients:
  - wet:
      - water:
          quantity: "123"
          unit: Cups
        fieldGroup: water
    fieldGroup: wet
In order to support this, changes have been made to the block renderer. ![image](https://user-images.githubusercontent.com/2900833/176383715-cc8e458e-d095-4577-b2a9-9d684614d180.png) The field configuration looks as follows: ```json { "frontMatter.taxonomy.contentTypes": [ { "name": "Recipe", "pageBundle": false, "previewPath": null, "fields": [ { "title": "Ingredients", "name": "ingredients", "type": "block", "fieldGroup": ["wet", "dry"] } ] } ], "frontMatter.taxonomy.fieldGroups": [ { "id": "wet", "fields": [ { "title": "Wet", "name": "wet", "type": "block", "fieldGroup": ["water", "oil"] } ] }, { "id": "water", "fields": [ { "title": "Water", "name": "water", "type": "fields", "fields": [ { "title": "Quantity", "name": "quantity", "type": "string", "single": true }, { "title": "Unit", "name": "unit", "type": "string", "single": true } ] } ] }, ... ] } ``` Output looks as follows in front matter: ``` ingredients: - wet: - water: quantity: "123" unit: Cups fieldGroup: water fieldGroup: wet ``` <!-- github-comment-id:1169661080 -->
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#293