# Layouts

> Change how saved web pages from one site are shown, with a small template and a live preview, without changing what was saved.

Source: https://crawl-docs.pdhq.win/guide/layouts/
Last updated: 2026-12-02

A **layout** decides where the parts of a saved web article go on the page: title, author, date, the body, and so on. It is set **per website**. A site with no layout is shown the normal way.

A layout only changes how a saved web **article** is shown. It never changes what was saved, and no scripts or raw HTML can get in: the template's text is escaped.

## Where a layout is used

| Place | Uses the layout? |
| --- | --- |
| The saved page (`index.html`) of a post, and every ZIP of an article | Yes. A ZIP of a post saved before the layout existed holds the layout page too. |
| A page drawn on demand at `bookmarks/<id>/files/layout.html` | Yes. This is what the editor's preview shows. |
| The post page in the web app | **Not yet.** The app shows an article with its own view. |
| The live view of a shared page for an old post | **Not yet.** The stored `index.html` of an old post is only redrawn when the post is saved again. |

A page whose layout cannot be read falls back to the normal page.

## Where

**Settings → Layouts** lists **Your sites**: the layout each site uses. It starts empty ("No site has a layout yet"). Under **Starting points** there are five to copy and change (**Copy it to edit**): Article, Docs, Product, Recipe and Thread.

## Make a layout

1. Press **Add a site**, or **Edit** on an existing one.
2. Fill in **Name** and **Site** (for example `recipes.example`). A site also covers its subdomains, and the most specific site wins: a layout for `docs.example.com` beats one for `example.com`.
3. Write the **Template**. Under **Parts you can use**, click one to put it where your cursor is.
4. Choose **Preview on** one of your saved pages of that site (it says **No saved page of this site** if you have none yet) and look at **Preview of the layout**. Errors are shown with their line number.
5. Save. At most 100 layouts can exist, one per site.

> [!SCREEN] The layout editor. On the left a box for the template with a list of parts above it that you can click. On the right the live preview of a saved page of that site, drawn with the template. Errors show under the box with their line numbers.

## The template language

Square brackets mark a part. Everything else is plain text, shown as a paragraph.

| Write | Gives |
| --- | --- |
| `[title]` `[author]` `[avatar]` `[date]` `[site]` `[reading]` `[original]` `[saved]` | One fact of the post. It is left out when the post has no such data. |
| `[body]` | Every part of the article that no `[part]` placed. |
| `[part "Ingredients"]` | The heading with that name and everything under it, up to the next heading of the same or higher level. |
| `[rule]` | A divider line. |
| `[columns 2]` ... `[next]` ... `[/columns]` | Two or three columns. On a phone they stack. |
| `[box tone=info]` ... `[/box]` | A framed note. The tone is `info`, `warn` or `note`. |

A small example for a recipe site:

```text
[title]
[author] [date]

[columns 2]
[part "Ingredients"]
[next]
[part "Method"]
[/columns]

[box tone=info]
Saved copy of the recipe.
[/box]

[body]
```

A layout is at most 20,000 characters. Columns and boxes can sit inside each other up to a few levels. It has no scripts and no HTML: text is escaped, and the result is drawn with fixed classes.

See [The layout language](https://crawl-docs.pdhq.win/advanced/layout-language.md) for the exact rules.
