Serving an Existing Directory
Because the file-page model needs no frontmatter and derives titles from headings, Accent CMS can serve an existing directory of markdown as a site without any preparation. This is the fastest way to preview a project’s documentation or turn a folder of notes into a browsable site.
Point --content-dir at any folder
# Serve your project's docs folder accent serve --content-dir ./docs # Serve any markdown collection accent serve --content-dir ~/notes
No restructuring is needed. README.md files become directory indices, titles
derive from headings, numeric filename prefixes set the order, and every page
renders through the default template.
How it works
Index filenames
A file with an index filename maps to its directory’s URL rather than to a child URL. By default Accent recognizes three names, ignoring case:
| Filename | Convention |
|---|---|
default.md | Accent CMS / Grav |
README.md | Documentation / GitHub |
index.md | Web / static-site |
When more than one is present in a directory, priority is default.md, then
README.md, then index.md. The first one answers the directory’s URL, and
the others are skipped with a warning.
If your tree uses another name for its landing pages, such as Home.md in a
GitHub wiki or overview.md in a doc set, list it in content.index_files.
the default:
# config.yaml content: index_files: [default.md, README.md, index.md, Home.md]
To use a different list for one part of the tree, put it in a _model.yaml
in that directory. It applies to the directory and every directory beneath it,
and the nearest _model.yaml that sets a list wins:
# docs/wiki/_model.yaml index_files: [Home.md]
A few rules keep the URLs predictable:
default.mdalways counts. Accent creates new pages asdefault.md, so a list that leaves it out still ranks it, last.- A name must be a plain filename ending in
.mdor.markdown. Names that start with_are page modules and names that start with.are hidden, so neither can be an index name. - On a multilingual site,
Home.de.mdis the German index of a directory whose list containsHome.md. accent serveandaccent buildpick the same file.
An invalid list in config.yaml stops the site from loading. An invalid list
in a _model.yaml is ignored with a warning, and accent validate reports it
as an error.
Title derivation
When a page has no title: in frontmatter – which is the common case for an
existing repository – the title is derived automatically:
- The first
# headingin the markdown content. - The filename, converted from kebab-case to Title Case, as a fallback when there is no heading.
Template fallback
Each file’s stem becomes its candidate template name; when the theme has no
matching template, Accent falls back to default.html.jinja. A folder of plain
markdown therefore renders end-to-end with only the default template – no theme
work required.
From quick preview to real site
Serving a directory is a starting point, not a dead end. When you want more control, layer it on incrementally:
- Add a numeric prefix to a filename (
01.intro.md) to pin its order. - Add a
title:ormenu.title:to refine navigation labels. - Move a page into a folder once it grows media or modules.
Nothing you add invalidates the plain files already there – the two models mix freely.