Skip to content

Metadata

User's guide

Metadata in Foliant allows you to assign additional properties to the chapters (Markdown files) and sections (parts of a Markdown file) of your project. These properties will be present in the Markdown sources but won't be directly rendered in the built documents. It is up to extensions to make use of these properties and alter your document in the desired way.

For instance, Confluence backend uses metadata to upload specific parts of your project into separate Confluence articles. AltStructure config extension uses metadata to rearrange the chapters of your project in the final build. TemplateParser preprocessor can access the metadata and generate chunks of text using the properties defined in it.

The foliantcontrib.meta package is required for metadata to work, but you won't need to install it directly. Every extension which uses metadata will install it automatically.

Syntax

There are two ways to define metadata:

  • In a YAML Front Matter — to define metadata for a whole chapter,
  • Using the `` tag to define metadata for a section, as well as for the chapter.

YAML Front Matter

YAML Front Matter (or YFM for short) must be defined at the very beginning of a Markdown file. Properties in the YFM are applied to the whole chapter.

---
author: John Smith
revision_date: 17 August 2021
---

In this example we've defined two properties: author and revision_date for one chapter.

Meta tag

Meta tags may add properties to smaller chunks of a Markdown file, as well as the whole chapter. If the meta tag is specified at the very beginning of the file, it acts similarly to the YAML Front Matter, e.g. is applied to the whole chapter. To add properties to a smaller chunk of a Markdown file, specify the tag under a heading. The metadata will be applied to the text under the heading and all nested headings.


Back to top