Data files view

Data files/folders are pieces of content that do not belong to any markdown content, but live on their own. Most of the time, these data files are used to store additional information about your project/blog/website that will be used to render the content.

For example: navigation, social media links, contacts, etc.

The data files dashboard allows you to quickly manage your data files.

Data files dashboard

Configuration

In order to use the data files dashboard, you will need to configure the extension with the following settings:

  • frontMatter.data.types: This only defines the object and its fields. Use this setting, if you want to re-use a data type in various files/folders.
  • frontMatter.data.files: Defines how a single data file.
  • frontMatter.data.folders: Defines that all files of a folder need to be treated the same.

Creating a data file

To create a data file, you can use the frontMatter.data.files setting.

Info: The singleEntry setting is used to define if the data file is a single entry or a not.

The above sample can be used to create a sponsor data file which contains an array of sponsor object with url, name, and description as properties.

Data dashboard - Sponsor example

Info: Use the [[workspace]] placeholder to define the workspace folder. The extension will automatically replace this with the workspace folder path.

Important: In the schema property we use the JSON Schema standard to define the structure of the data file.

Re-using a data type for files or folders

In some cases, you might want to re-use a data type for files or folders. You can do so by using the frontMatter.data.types setting in combination with the frontMatter.data.files and/or frontMatter.data.folders settings.

First the data type, this is an object containing the id and schema properties.

In the frontMatter.data.files and/or frontMatter.data.folders settings, instead of defining the schema property, you can use the type property to reference the data type.

Important: when using data folders, the extension searches for yml, yaml, and json files in the folder.

Feedback/comments

Last updated on

Did you spot an issue in our documentation, or want to contribute? Edit this page on Github!

Ready to get started?

Special thanks to our backers & sponsors

VercelBEJS Community