Defining the default contents of new files

Provide default front matter and/or content for new collection items.

To define defaults, create a file called _defaults.md in the root of the collection folder. When creating a new item in that collection, front matter and content will be copied from _defaults.md.

Default files are hidden in the collection view to prevent an editor accidentally changing them.

Note

Set the default extension for new files to .html by using _defaults.html instead.

Defaults are scoped to their collection. For example:

  • /_staff/_defaults.md contains defaults for new staff members
  • /_posts/_defaults.md contains defaults for new posts

Creating a new item in these collections will copy the information from the relevant _defaults.md file. If the title and name attributes are present, they are set to the name of the new item.

Note

Looking to set the default values for new array items? Use Array Structures instead.

Was this article helpful? or Suggest an improvement >

Related articles