# Write pages

Every `.md` file under the folder is a page. `install.md` and
`install/index.md` both serve `/install`; `index.md` serves the root.

Elysium serves every other file at its own path beside the pages, so
`guide/shot.png` serves `/guide/shot.png`. Elysium skips folders and files that
start with `.` or `_`, the assets folder and `elysium.json`.

## Frontmatter

```md
---
title: Install the app
nav: Install
description: Get the app on your machine.
order: 2
---

Run the installer.
```

All of it is optional:

| Key           | Sets                                                                              |
| ------------- | --------------------------------------------------------------------------------- |
| `title`       | the page title; falls back to a leading `# Heading`, then the file name           |
| `nav`         | a shorter label for the sidebar                                                   |
| `description` | the meta tag, the search entry and the line in `llms.txt`                         |
| `order`       | the page's place in its section, before titles sort the rest                      |
| `template`    | the [template](template.md#a-template-per-page) to use, by its path in the folder |
| `hidden`      | `true` builds the page but lists it nowhere                                       |
| `draft`       | `true` skips the file: no page, and links to it break                             |

A leading `# Heading` leaves the body, since the template shows the title. It
becomes the title unless the frontmatter sets one, and then the frontmatter
wins.

A hidden page stays out of the sidebar, previous and next, search, `llms.txt`,
`llms-full.txt` and the sitemap. Link to it to reach it.

Frontmatter is YAML, so quote a value that holds `: `:
`description: "Step one: install"`.

## Sections

Without `sections`, the root's pages form the first group, and each folder
forms another, titled by its `index.md`.

To pick the groups and their order yourself, list each page by its route
without the leading `/`, with `""` for the root:

```json
{
  "sections": [
    { "title": "Start", "pages": ["", "install"] },
    { "title": "Guides", "pages": ["guides/deploy", "guides/backup"] }
  ]
}
```

With `sections`, every page that is not hidden must appear in one, or the
build fails. The order of the lists sets previous and next.

## Links

Link to another page by its file, or by its name as a wikilink:

```md
Read [Install](install.md) first, or [[Install]], or [[Install#Linux]].
```

A file link is relative to the page, as on GitHub; a leading `/` starts from
the docs folder. A wikilink finds the page by its path, file name or title, in
any case. A name two pages share finds neither. A link to a missing page, or to
a heading the page lacks, fails the build.

## Examples

````md
```example
**Bold** and _italic_.
```
````

An `example` fence shows the source beside the output, as on
[Markdown syntax](https://charon.memomori.app/docs/syntax). Links inside an example stay as written.

## Images

An image resolves the way it does on GitHub:

- `![Shot](shot.png)` and `![Logo](../logo.svg)` are relative to the page's
  file, and so is `![Boat](_assets/boat.svg)` on a page beside the assets
  folder.
- `![Boat](/_assets/boat.svg)` points into the assets folder by its URL.
- A path with spaces goes in angle brackets: `![Shot](<my shot.png>)`.

A missing image, or one outside the docs folder, fails the build and names the
page.

## Embeds

`![[Note]]`, `![[Note#Heading]]` and `![[photo.webp|300]]` embed files from the
assets folder by name. The assets folder is `<dir>/_assets`, served at
`/_assets` under the base.

## Diagrams

`mermaid` fences render to inline SVG at build time, so readers load no
diagram script. Set the font with `--diagram-font` or `diagrams.fontFamily`.

## Broken things

The build checks every page, reports every broken link, embed and image
together, each with its page, then exits with an error and writes nothing.
