Skip to content
qino

Content folder

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

View Markdown
On this page

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 /.

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

For the three Markdown formats, the schema validates the frontmatter only. qino then adds the body as a markdown string. See Frontmatter and 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.

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:

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:
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:

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:

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.

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:

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.