Meta data goes at the top of documents, and is defined by any character that repeats 3 or more times. For example,
--- is the most common usage, but you can also use
### or whatever repeats 3 or more times. By default, we parse the meta data with YAML but you can also use CSON by doing
--- cson instead.
An example document that uses meta data will look like this:
---title: "Example Document"layout: "default"---My example document content
The title for the document. Useful for headings.
Tells DocPad what layout to use from the
layouts folder. Layout files can use other layouts for advanced layout nesting.
There is no default value. Layouts may have a layout called "default", but that is just a naming choice, rather than an implicit default.
Defaults to the
filename. The name of the document. Useful for listings.
mtime. Useful for setting a custom date via your documents meta data.
Defaults to a slugified version of the
relativeBase. Appears deprecated in favour of
The URL that you would like to use as the primary URL for the document. When a user accesses a document via a secondary URL, the user will be redirected to the primary URL automatically.
The secondary URLs for a document. It can be a comma separated values list, or an array of values.
false. If set to
true, the document will not be parsed. Useful for draft documents.
false. If set to
true, when a change is detected for the document, we will only regenerate this document and not anything else (e.g., documents with
referencesOthers set to
false. If set to
true, this document will be regenerated when a change occurs in another document. It is automatically set to
truewhenever a template helper is called that references another document. This makes so for instance on a blog listing page, when a blog post is changed, we will also regenerate the listing as well as the blog post.
. Tags can be a comma separated values list, or an array of values. While DocPad doesn't use tags for anything specifically, it is nice to have it handled uniformly across websites without you having to do it yourself.
false. If set to
true, the document will be re-rendered on each request. This also adds the
req object to the template data.
The unique document identifier. Defaults to the cid. When we get the
relativePath, we set the
id to that instead.
The file's name without the extension.
The file's last extension (e.g., will be set to
eco for the file
The extension used for the output file. Same method as
extension however it takes layouts into account as well.
The file's extensions as an array (e.g., will be set to
["md","eco"] for the file
The file's name with the extension.
The full path of our source file.
The full path of our output file.
The full directory path of our source file.
The full directory path of our output file.
The file's name with the output extension.
The relative path of our source file.
The relative path of our output file.
The relative directory path of our source file.
The relative directory path of our output file.
The relative path of our source file without the file's extension.
The MIME content-type for the source file.
The MIME content-type for the output file.
Date object for when this file was created.
Date object for when this file was modified.
The encoding of the file. Either
binary, this is set to the raw contents of the file, stored as a string.
binary, this is set to the contents of the file, stored as a string. This is used internally during the rendering process, end-users should never use this property, instead they should either
contentRendered depending on the use case.
true. Whether or not this document should be written to the output directory.
true. Whether or not this document should be rendered.
The file meta data (header) in String format before it has been parsed.
yaml. The parser we used to parse the document's meta data header.
The file content (without the meta data header) before we've rendered it.
false. Set to
true once we have been rendered.
The rendered content (after is has been wrapped in the layouts).
The rendered content (before being wrapped by the layouts).
Same as the Backbone Model toJSON, but will also call
toJSON on the original meta data to
meta within the result.
Get the meta data Backbone Model for the file.
Same as the Backbone Model Set, but for the meta data Model.
Same as the Backbone Model Set, but will only set attributes that haven't already been set to something.
Same as the Backbone Model Set, for the meta data but will only set the meta data Model attributes that haven't already been set to something.
Used for setting data of a virtual file (a file that does not have physical path).
Used for getting the data of a virtual file (a file that does not have physical path).
Used for setting the source buffer.
Used for getting the source buffer.
Used for setting the stat of the file.
Used for getting the stat of the file.
Used for getting the parsed source content or the buffer instance if it is a binary file.
Used for getting the rendered content.
Is the file a text file?
Is the file a binary file?
Set the primary URL for the file.
Set a secondary URL for the file.
Remove a URL for the file.
Gets a path relative to the file.
Whether or not this document references another document. Sets the