---
title: "Content folder"
description: "Allowed file types and how collections, trees, and items are laid out on disk."
canonical: "https://www.qino.works/docs/guide/content-folder"
---

# Content folder

> Allowed file types and how collections, trees, and items are laid out on disk.

The content folder is the directory passed as `contentFolder` to `initQino`. Each primitive owns a path inside it.

## Content paths

Every path qino reads, in primitive definitions and in content, is a **content path**: relative to the content folder, with no leading `/`.

```ts title="qino/collections/posts.ts"
qino.defineCollection({ directory: "posts", ... }); // src/content/posts/
qino.defineItem({ file: "pages/home.md", ... });     // src/content/pages/home.md
```

Content paths are relative to the content folder, not to the file they appear in. `authors/jane.json` written in `posts/hello.md` points to `src/content/authors/jane.json`. A leading `/` is an error with a fix-it hint.

## Allowed file types

| Extension   | Parsed as                        |
| ----------- | -------------------------------- |
| `.md`       | YAML frontmatter + Markdown body |
| `.mdx`      | YAML frontmatter + MDX body      |
| `.markdown` | YAML frontmatter + Markdown body |
| `.json`     | A JSON object                    |

For the three Markdown formats, the schema validates the frontmatter only. qino then adds the body as a `markdown` string. See [Frontmatter](https://www.qino.works/docs/guide/frontmatter) and [Schemas](https://www.qino.works/docs/concepts/schemas).

## Collections

A collection is a flat directory. Every file with the configured extension is an entry, and the slug is the filename without that extension.

```txt title="Folder structure"
src/content/posts/
  hello-world.md        slug "hello-world"
  second-post.md        slug "second-post"
  notes.txt             ignored, wrong extension
  drafts/wip.md         ignored, nested
  .hidden.md            ignored, hidden
```

Dots elsewhere in a filename stay in the slug. Nested files, hidden files, and other extensions are skipped.

## Trees

A tree is a nested directory. Every node is backed by a file, and a node with children is a file plus a folder of the same name:

```txt title="Folder structure"
src/content/docs/
  _order.json
  introduction.md               slug "introduction"
  guides.md                     slug "guides", anchor for guides/
  guides/
    _order.json
    setup.md                    slug "guides/setup"
    deploy.md                   slug "guides/deploy"
```

Rules:

- **Every non-empty folder needs a sibling file** with the same name and the tree's extension. `guides/` requires `guides.md`. A missing anchor is an error. An empty folder is ignored.
- **No index files.** The anchor's frontmatter titles the node and its body is the section's content.
- **Slugs are slash-joined paths** minus the extension: `guides/setup`.
- **`_order.json` is optional** and orders one folder's children. It is a JSON array of filenames including the extension:

```json title="src/content/docs/_order.json"
["introduction.md", "guides.md"]
```

Listed files come first in the given order. Unlisted files follow in alphabetical order. Entries must name the anchor file, never the folder, and must end in the tree's extension. An entry that does not exist on disk is an error. Without the file, a folder sorts alphabetically. The filename is configurable per tree with `orderFileName`.

## Items

An item is a single file at a fixed path. The extension is taken from the path, so there is no `extension` option:

```txt title="Folder structure"
src/content/pages/
  home.md               defineItem({ file: "pages/home.md" })
```

A missing file is an error at read time.

## Relation values

A relation stores the content path of the target, relative to the content folder, with the extension:

```yaml title="src/content/posts/hello-world.md"
author: "authors/camille-laurent.json"
categories:
  - "categories/content-modeling.json"
```

Bare slugs are rejected. The directory and extension must match the target primitive. For item targets, the value must equal the item's `file`. See [Relations](https://www.qino.works/docs/concepts/relations).

A relation value can also be a **root path**: a path from the project or repository root that goes through the content folder. qino strips everything up to the content folder:

```yaml title="src/content/posts/hello-world.md"
author: "src/content/authors/camille-laurent.json" # from the project root
categories:
  - "apps/site/src/content/categories/content-modeling.json" # from the monorepo root
```

These resolve like `authors/camille-laurent.json` and `categories/content-modeling.json`. This keeps content written by Git-based CMSs such as Decap CMS, which store paths from the repository root, working with qino.

## Reserved names

- `_meta` is reserved at the top level of every content file and every schema.
- `markdown`, `_stats`, and `_toc` are reserved in Markdown frontmatter and schemas; qino adds them after validation. In JSON files, they are ordinary fields.

Nested keys with those names are ordinary user fields.

## Media folder

`mediaFolder` is declared on `initQino` and must exist; `qino lint` checks it. Image and asset paths in content are plain strings. `qino check` verifies that every local file reference exists. See [Media](https://www.qino.works/docs/guide/cli#media).
