Authoring Content
Front matter in Markdown and .bxm files, the keys and fields every document has, and defaults for a whole folder.
Front matter
Front matter must start on the first line of the file.
In .md files it sits between --- lines:
markdown---
type: post
title: Hello World
description: The first post
date: 2026-01-15
tags:
- boxlang
- getting started
---
# Hello
In .bxm files it is a leading <!--- ---> comment:
html<!---
type: page
title: Home
--->
<bx:output>
<bx:loop array="#collections.post#" item="post">
<a href="#post.permalink#">#post.title#</a><br />
</bx:loop>
</bx:output>
A leading .bxm comment counts as front matter only if it parses as a YAML mapping. Any other leading comment stays in the page as an ordinary comment, and the build prints a warning naming the file. In .md files, front matter that is not valid YAML, or a missing closing ---, fails the build.
| Key | Default | Meaning |
|---|---|---|
title | "" | Page title. The starter layout puts it in <title>. |
description | "" | Short description. The starter layout puts it in <meta name="description">, falling back to the site description. |
type | page | Document type. Picks the default view and the collection the document joins (collections.<type>). |
layout | main | Layout in _includes/layouts/, without extension. none renders without view and layout. |
view | the type | View in _includes/, without extension. |
slug | file name | Last part of the URL when there is no permalink. |
permalink | derived from the path | Output URL. See URL scheme. |
fileExt | html | Output extension, for example xml for a feed. |
date | see below | Date of the document; the sort key for posts. |
publishDate | Used as the date when date is absent. | |
tags | A tag or a list of tags. Builds collections.tags and collections.byTag. An empty tags: is allowed. | |
published | true | false makes the document a draft. See --drafts. |
excludeFromCollections | false | true builds the page but keeps it out of every collection. |
excerpt | see below | Summary used as prc.excerpt, for example in a post list or feed. |
pagination | Expands the document into several pages. See Pagination. |
The date of a document is date, else publishDate, else the date at the start of its file name, else the file's modified time. A value that is not a date is ignored with a warning.
A file named YYYY-MM-DD-name.md (or .bxm), such as posts/2026-03-01-launch.md, takes 2026-03-01 as its date when it sets neither date nor publishDate. A prefix that is not a real date (2026-13-40-x.md) is ignored without a warning. The default URL still contains the whole file name (/posts/2026-03-01-launch/); use slug, permalink or a permalink pattern to drop the date from it.
Besides its front matter keys, prc holds:
| Field | Meaning |
|---|---|
inFile | Source path relative to the site root, for example posts/hello-world.md |
outFile | Output path relative to outputDir, for example posts/hello-world/index.html. Never includes the baseUrl path. |
permalink | URL of the page, for example /posts/hello-world/, or /blog/posts/hello-world/ with a baseUrl path of /blog |
absoluteUrl | Full URL of the page, https://example.com/blog/posts/hello-world/, when baseUrl has a scheme and host; otherwise the same as permalink. An absoluteUrl set in front matter (the document's, folder defaults', or its layout's or view's) is kept as written. |
fileSlug | Source file name without extension |
content | Converted Markdown for .md; in views, the rendered document |
excerpt | A short summary as HTML. See below. |
previous, next | Neighbouring documents of the same type. See below. |
date | Resolved date (a date object) |
lastModified | File modified time, ISO 8601 |
prc.excerpt is the excerpt front matter key when there is one, from the document, its folder defaults, or its layout or view. Otherwise, when the body contains <!--more-->, it is everything before the marker (for .md converted to HTML; for .bxm the template source before the marker, not executed). Otherwise, for .md, it is the first paragraph (<p>...</p>) of the converted HTML, and for .bxm it is "". The marker itself stays in prc.content; as an HTML comment it does not show.
prc.previous and prc.next link each document to its neighbours in collections.<type>, in that collection's order. Posts are newest first, so on a post next is the newer post and previous the older one. Each is an empty struct when there is no neighbour, and otherwise a small struct { title, permalink, absoluteUrl, date }:
html<bx:if !prc.next.isEmpty()>
<a href="#prc.next.permalink#">#prc.next.title# →</a>
</bx:if>
Documents that are not in collections get empty structs. If the front matter already sets excerpt, previous or next, that value is kept as written.
Folder defaults
A file named _defaults.yml, _defaults.yaml or _defaults.json in any folder supplies front matter for every document in that folder and the folders below it:
yaml# posts/_defaults.yml
type: post
layout: main
author: boxlang-ssg
Precedence, highest first:
- the document's own front matter
- the nearest folder's defaults, then each parent folder's, up to the site root
- the built-in defaults (
type: page,layout: mainand the others in the table above) - layout and view front matter, which only fills keys still missing
Keys are merged one by one at the top level; a struct or list value in a document replaces the default's whole value. A permalink from folder defaults counts as an explicit permalink. A defaults file that does not parse, or one that is not a mapping, fails the build naming the file, and so do two defaults files in the same folder. Defaults files are never rendered (only a passthru folder would copy one).