Enhancement: Allow content creation to create a single file or content folder #114

Closed
opened 2026-10-05 02:26:05 +02:00 by adam · 6 comments
Owner

Discussed in https://github.com/estruyf/vscode-front-matter/discussions/140

Originally posted by drwilkins October 10, 2021
I'm using doks to create my site's documentation and blog. It expects blog entries to be bundled in a new subfolder; e.g. blog/new-blog-entry/, which contains index.md and any images.

Can this structure be created using vscode-front-matter when I click "Create Content" on the Dashboard?

Requirements

  • New global setting frontmatter.content.folderCreation (boolean - default: false)
  • New Content Type pageBundle property. By default a file gets created, if you want to create page bundles, add the pageBundle: true setting to the Content Type.
  • Folder creation logic
  • Allow the insert media to be focussed immediately on the content folder of the content.

Ideas

Does the creation of a folder always need to happen? Or is this specific per content type?

### Discussed in https://github.com/estruyf/vscode-front-matter/discussions/140 <div type='discussions-op-text'> <sup>Originally posted by **drwilkins** October 10, 2021</sup> I'm using [doks](https://getdoks.org/) to create my site's documentation and blog. It expects blog entries to be bundled in a new subfolder; e.g. blog/new-blog-entry/, which contains index.md and any images. Can this structure be created using vscode-front-matter when I click "Create Content" on the Dashboard? </div> ### Requirements - ~~New global setting `frontmatter.content.folderCreation (boolean - default: false)`~~ - New Content Type `pageBundle` property. By default a file gets created, if you want to create page bundles, add the `pageBundle: true` setting to the Content Type. - Folder creation logic - Allow the insert media to be focussed immediately on the content folder of the content. ### Ideas Does the creation of a folder always need to happen? Or is this specific per content type? <!-- github-sync-id:1022022837 -->
adam closed this issue 2026-10-05 02:26:05 +02:00
Author
Owner

@drwilkins I worked on the first implementation to support page bundles. In order to use it, you'll need to specify the new pageBundle property on the content type of your choice.

As example:

"frontMatter.taxonomy.contentTypes": [
  {
    "name": "default",
    "pageBundle": true,
    "fields": [
      {
        "name": "title",
        "type": "string"
      },
      {
        "name": "description",
        "type": "string"
      },
      {
        "name": "date",
        "type": "datetime"
      },
      {
        "name": "preview",
        "type": "image"
      },
      {
        "name": "draft",
        "type": "boolean"
      },
      {
        "name": "tags",
        "type": "tags"
      },
      {
        "name": "categories",
        "type": "categories"
      }
    ]
  }
]

Setting it on content type level allows you to specify multiple CTs and define which ones should create these page bundles.

@drwilkins I worked on the first implementation to support page bundles. In order to use it, you'll need to specify the new `pageBundle` property on the content type of your choice. As example: ```json "frontMatter.taxonomy.contentTypes": [ { "name": "default", "pageBundle": true, "fields": [ { "name": "title", "type": "string" }, { "name": "description", "type": "string" }, { "name": "date", "type": "datetime" }, { "name": "preview", "type": "image" }, { "name": "draft", "type": "boolean" }, { "name": "tags", "type": "tags" }, { "name": "categories", "type": "categories" } ] } ] ``` Setting it on content type level allows you to specify multiple CTs and define which ones should create these page bundles. <!-- github-comment-id:939761131 -->
Author
Owner

@drwilkins you can now test it out in the beta version of the extension: https://beta.frontmatter.codes/docs/getting-started#beta-version

Important: In order to test it, you will have to uninstall the main version of the extension. As both cannot run and be installed at the same time. Any of your configuration will not be lost in the uninstall process.

@drwilkins you can now test it out in the beta version of the extension: https://beta.frontmatter.codes/docs/getting-started#beta-version **Important**: In order to test it, you will have to uninstall the main version of the extension. As both cannot run and be installed at the same time. Any of your configuration will not be lost in the uninstall process. <!-- github-comment-id:939763746 -->
Author
Owner

Hey Elio,

Thanks, this looks promising! So I installed the beta after uninstalling my existing version. I guess I don't understand where the json structure above should be added...Do I create a new file in .frontmatter/content? I tried adding pageBundle: true to a blog.md file in .frontmatter/templates/blog.md and then creating a new entry through frontmatter from this template, which didn't seem to work.

Hey Elio, Thanks, this looks promising! So I installed the beta after uninstalling my existing version. I guess I don't understand where the json structure above should be added...Do I create a new file in .frontmatter/content? I tried adding `pageBundle: true` to a blog.md file in .frontmatter/templates/blog.md and then creating a new entry through frontmatter from this template, which didn't seem to work. <!-- github-comment-id:940218724 -->
Author
Owner

Hi @drwilkins, you will need to specify this on content type level in the frontmatter.json file. More information can be read here: https://beta.frontmatter.codes/docs/content-types#content-type-properties

Templates do not yet support the folder creation, this will be added next, but you'll still use the content type.

Hi @drwilkins, you will need to specify this on content type level in the `frontmatter.json` file. More information can be read here: https://beta.frontmatter.codes/docs/content-types#content-type-properties Templates do not yet support the folder creation, this will be added next, but you'll still use the content type. <!-- github-comment-id:940374512 -->
Author
Owner

In the next beta version that gets released in a couple of minutes. Content created from templates now also supporting the page bundles.

In the next beta version that gets released in a couple of minutes. Content created from templates now also supporting the page bundles. <!-- github-comment-id:940391435 -->
Author
Owner

Fantastic, thanks!

FYI, I don't have a frontmatter.json file. I got the approach above to work by adding your content type parameter list to .vscode/settings.json.

Fantastic, thanks! FYI, I don't have a frontmatter.json file. I got the approach above to work by adding your content type parameter list to .vscode/settings.json. <!-- github-comment-id:940398265 -->
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#114