Skip to content

DocFrontMatter

type DocFrontMatter =
    {
        Title: string
        Description: string option
        OgImage: PageImage
        Order: int option
        Layout: string option
        PageNav: bool option
        MenuFilter: bool option
        MenuMemory: bool option
        Toc: TocSetting option
        Main: (string * string) list
    }
AssemblyNacara.Theme.Docs

Front matter understood by the theme's ready-made collection.

The shape of every page's --- block. A site wanting fields of its own declares its own record and its own decoder; this one is what Theme.docs reads, and the only required field is the title.

Fields

Title: string

The page's title: its heading, its entry in the menu, and what search shows.

Description: string option

One sentence about the page, for search results and the page's meta description.

OgImage: PageImage

The image a link to the page is shown with on social sites.

A path relative to the site root or an absolute url, a mapping with url, alt, width and height, or false for no image at all:

ogImage:
url: social/install.png
alt: The installer
Order: int option

Where the page sits among the pages of its section.

Read only when the section has no menu declared - a menu says the order outright, and then this says nothing. Pages without one come last, in title order.

Layout: string option

Which layout renders the page, when it is not the ordinary one.

layout: bare is a page with no chrome: no menu, no table of contents, no previous and next links. A landing page is the usual reason.

PageNav: bool option

Whether this page offers the previous and next pages of its section.

pageNav: false for a page that is not part of a sequence - a landing page, or one of a set a reader arrives at by name rather than by reading through.

MenuFilter: bool option

Whether a box for filtering the section's menu is offered.

Left out, the theme decides: a menu long enough that finding a name means opening folds gets one, a menu you can read at a glance does not. menuFilter: true asks for one regardless, menuFilter: false refuses it.

MenuMemory: bool option

Whether the menu carries a reader's folding over to the next page.

menuMemory: false for a section read by name rather than in order - a reference - where every page opens the menu the same way: the trail to itself, and nothing else.

Toc: TocSetting option

The table of contents: toc: false for none, or the heading levels it holds.

toc:
from: 2
to: 2

A page whose sections are uninteresting on their own - a changelog, where the versions are what a reader navigates by - says so here. Left out, the markdown plugin's option decides for the whole site. Either bound may be left out: from is 2, a page's own title being the only heading above it, and to is 6.

Main: (string * string) list

Attributes to put on the page's <main>:

main:
data-pagefind-weight: "0.3"

id, class and tabindex are the theme's own and cannot be set here.

Functions and values

decoder: Decoder<DocFrontMatter>

Reads the theme's front matter, knowing the layouts of layouts.

decoderWith (known: string list) : Decoder<DocFrontMatter>

Reads the theme's front matter, failing the build with file and line when it cannot.

Parameter
knownThe layouts a page may ask for. Any other fails the build.
layouts: Map<string,(DocPage -> DocPage)>

The layouts every theme built on this vocabulary knows.

Keyed by what layout: says in front matter. A theme with layouts of its own adds to this map and reads front matter with decoderWith.

toDocPage (frontMatter: DocFrontMatter) : DocPage

The theme's view of a page, knowing the layouts of layouts.

Parameter
frontMatterWhat the page said about itself.
toDocPageWith (layouts: Map<string,(DocPage -> DocPage)>) (frontMatter: DocFrontMatter) : DocPage

The theme's view of a page described by this front matter.

Parameter
layoutsWhat each layout: a page may ask for does to the page.
frontMatterWhat the page said about itself.