# Content configuration

How Docsheaf lays out a space as files, and how it reads them back.

## `.docsheaf.yaml`

An optional file in the synced folder, in the same format as GitBook's `.gitbook.yaml` (which Docsheaf
also reads):

```yaml
root: ./docs/

structure:
  readme: README.md
  summary: SUMMARY.md
```

| Key | Meaning |
| --- | --- |
| `root` | The folder, relative to this file, where the pages live. |
| `structure.readme` | The file of the first page. |
| `structure.summary` | The table of contents. |

## `SUMMARY.md`

The table of contents decides the order and nesting of pages:

```markdown
# Table of contents

* [Introduction](README.md)

## Getting started

* [Quickstart](getting-started/quickstart.md)
* [Guides](guides/README.md)
  * [Deploy](guides/deploy.md)
* [Status page](https://status.example.com)
```

- `##` headings become **groups**.
- Indented items become **sub-pages**.
- Items with an `https://` address become **links**.
- A top-level page after a group goes after a `---` line.

Without a `SUMMARY.md`, Docsheaf builds the tree from the folders: each folder is a group, and its
`README.md` opens it.

## Page files

Each page is a Markdown file with optional [front matter](markdown#front-matter).
The first `# Heading` is the title. A page with sub-pages is written as `<slug>/README.md`.

Links between pages are written as relative file paths — `[Deploy](../guides/deploy.md)` — and read back
as page links, so they survive moves on either side.

## Images and files

Relative images and files that pages point to are uploaded on import. Docsheaf writes the uploads it
manages to `.docsheaf/assets/`; images already in your repository stay where they are.

## What Docsheaf touches

Docsheaf only writes the pages and uploads of the space, and deletes files it wrote earlier when their
pages are gone. Everything else in the repository — code, CI files, other folders — is never touched.
