Page data

Assign custom data to the pages

Pages can contain arbitrary data. In Markdown files, the data is defined in the front matter block, a block delimited by two triple-dashed lines containing YAML code. There are other formats that can have front matters or store the data in different ways. Let's see some examples:

title: This is the title
url: custom-url.html

This is the page content

In the examples above, all pages contains two variables: title and url.

In the formats with a front matter (like Markdown and Nunjucks), the content is defined below the front matter. Formats that don't use front matter exports the content as the content variable or, optionally, as a default export (like in page.tmpl.js).

Standard variables

There are some special variables that Lume can understand:

  • url: Contains the public URL of the page, useful to create links and configure the output filename. If it doesn't exist, it's generated automatically by lume. See URL docs
  • date: By default it's the file creation date but you can override with this variable (or prepending it to the filename). This value is used to sort the pages in a list.
  • layout: To define the layout that is used to render the page. See Layouts
  • tags: Tags are used to group pages. See Tags
  • templateEngine: To override the template engine used to render the page. See
  • renderOrder: To customize the order in which the page is rendered. See Render Order
  • mergedKeys: To customize how some data is merged. See Merged Keys docs
url: /welcome.html
date: 2021-01-01
layout: layouts/post.njk
draft: true
tags: post