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.
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
singleEntrysetting 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.
Info: Use the
[[workspace]]placeholder to define the workspace folder. The extension will automatically replace this with the workspace folder path.
Defining a data schema
schema property is used to define the structure of the data file. The schema is defined using
the JSON Schema standard.
The following example shows a schema for a sponsor object:
The following field types are supported:
When you are using the
string type, you can use the
multiline property to define if the field is
a multiline field.
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
First the data type, this is an object containing the
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
jsonfiles in the folder.
Did you spot an issue in our documentation, or want to contribute? Edit this page on Github!