Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
estruyf opened this issue Oct 10, 2021 Discussed in #140 · 6 comments
Closed

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

estruyf opened this issue Oct 10, 2021 Discussed in #140 · 6 comments
Labels
enhancement New feature or request
Milestone

Comments

@estruyf
Copy link
Owner

estruyf commented Oct 10, 2021

Discussed in #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?

estruyf added a commit that referenced this issue Oct 11, 2021
@estruyf
Copy link
Owner Author

estruyf commented Oct 11, 2021

@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.

@estruyf
Copy link
Owner Author

estruyf commented Oct 11, 2021

@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.

@estruyf estruyf added this to the 5.1.0 milestone Oct 11, 2021
@estruyf estruyf added the enhancement New feature or request label Oct 11, 2021
@drwilkins
Copy link

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.

@estruyf
Copy link
Owner Author

estruyf commented Oct 11, 2021

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.

@estruyf
Copy link
Owner Author

estruyf commented Oct 11, 2021

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

@drwilkins
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants