Skip to content

Front matter

The fields a page can set in its --- block. Only title is required; a page that sets nothing else gets a menu, a table of contents, and links to the pages either side of it.

---
title: Writing content
description: Front matter, links and directives
order: 2
---

Fields

title

type: string (required)

You must provide a title for every page. It is shown at the top of the page, in the browser tab, in the menu, and in search results.

description

type: string

The page description, picked up by search engines and in social previews.

order

type: number

Controls where the page sits in its section, when no menu is declared for that section. Pages without one come last, in title order.

layout

type: 'splash' | 'bare'

Set to splash for a page without the menu or the table of contents. The theme's styles and spacing are kept, over a wider measure - --nacara-splash-width, 68rem. Landing pages are the usual case.

Set to bare for a page you lay out yourself. The navbar and the footer stay, all the other elements are removed, and the theme adds no styles, no width and no padding.

---
title: My library
layout: splash
---

type: boolean

default: true

Set to false to drop the links to the previous and next pages of the section.

type: boolean

Whether the menu offers a box for filtering it. Left out, the menu's length decides. See Menu.

type: boolean

default: true

Whether the menu keeps what the reader folded from one page to the next. Set to false and every page of the section opens the menu the same way. See Menu.

toc

type: false | { from?: number; to?: number }

default: the range the markdown plugin was configured with

false leaves the table of contents out.

A range says which heading levels it holds; either bound can be left out.

---
title: Releases
toc:
  from: 2
  to: 2
---

main

type: { [name: string]: string }

Attributes to put on the page's <main>. id, class and tabindex are the theme's own and fail the build if set here.

---
title: Legacy API
main:
  data-pagefind-weight: "0.3"
---

Front matter of your own

Theme.docs reads the theme's DocFrontMatter, which is these fields and nothing else. To add fields of your own - an author, a tag, a product - declare your own record and decoder, then map it onto what the theme needs. Components shows how, along with the DocPage setters that decide the same things from code.

Edit this page