```meta
title: Templates — what pages have in common
description: A menu, a footer and a side column written once, in a template page the others wear. With parts any page may replace.
```

_flows.md · documentation_

# Templates

On a site, almost every page has the same things around it: the menu on top, the footer below, sometimes a side column. Copying that onto each page works until the day the menu changes — and then there are ten pages to fix.

A **template** is an ordinary page that has a `:::slot`. What is around the slot is what the pages have in common. The other pages **wear** the template: a reader gets the page inside it.

## Writing a template

````
:::nav
**[Studio](./)**
---
- [Work](./work)
- [About](./about)
:::

:::slot
:::

:::footer
Made here.
:::
````

A template's links are relative to **the page that declared it** — the site's root. `./about` is that site's "about" on every page that wears the template, and the same template serves two sites, each with its own links. The link to the page being read is marked.

## Where templates live

In the space's `templates` page: the template named `site` is the page `/@you/templates/site`. It is a page like any other — it has the editor, languages and history — which is why this page, [/@docs/templates](/@docs/templates), also holds @docs' own templates. The templates of your spaces show together at [/~templates](/~templates), beside your views.

## Wearing it

One fence with the template's **name**, once, on the site's root page:

````
```template
site
```
````

A name, not an address: no path, no tilde.

It applies to the page and to **every page below it**. The order is the themes': the page's own fence, then the nearest page above, then nothing.

| In the fence | What it does |
|---|---|
| `site` | wears this space's template `site` (`docs/guide` works too: a page inside another) |
| `cascade: false` | only this page wears it, the ones below do not |
| `none` | this page (and the ones below) wear nothing |

A page that has a slot never wears a template by inheritance — only when it names another itself.

## Replacing a part on one page

A template may have named places, each with what shows when nobody says otherwise:

````
:::slot name:cta
## Let's talk
[Write to us](./contact)
:::
````

A page replaces that part with `:::fill`:

````
:::fill name:cta
## We are hiring
[See the roles](./jobs)
:::
````

The names are `main` (the page's content), `hero`, `aside`, `top`, `bottom` and `cta`. A `:::fill` for a place the template does not have stays where it was written — nothing you wrote disappears.

## A template that wears another

The docs template can wear the site's: the site's gives the menu and the footer, the docs' adds the side column around the slot.

````
```template
site
```

:::section width:wide
:::split rail:16 sticky:first
**Guide**

[Getting started](./start)
---
:::slot
:::
:::
:::
````

## Seeing it

The editor shows the page's own content. To see it as it is served, inside its template, open **Layout** in the editor's menu and choose **See it as a reader** — or add `?as=reader` to the address.

## An example you can open

The [Orbit](/@docs/showcase/orbit) showcase has three pages and one menu: it is in [templates / orbit](/@docs/templates/orbit), with an English version, and all three wear it by saying just `orbit`.
