A guide collection read as a tree: folders are categories, at any depth.
The one-level layout Gamend.Content started with — 10-setup/50-theme.md,
a folder per category and nothing deeper — is what a handful of guides
want. A manual with a reference section of a hundred pages wants
reference/components/body2d.md, a category inside a category, an
index.md that is the category's page, and URLs that keep that shape.
This module reads that layout; the flat one stays where it was.
What the file tree says
- A folder is a category. Its
_category.mdnames it (title,icon,color,position,collapsed,description); without one, the folder name is humanised. index.mdin a folder is that category's own page, at the category's slug. Without one, the category still has a page — the renderer lists its children.- A file is a guide. Its slug is its path with each segment's order prefix
stripped and the extension dropped:
10-manual/20-scenes.mdismanual/scenes. Frontmatterslugoverrides that —/referencefor the whole thing, or a bare name for the last segment. - Order is frontmatter
position(orsidebar_position), then the numeric filename prefix, then the name. A guide with neither sorts after every guide with one. - A name beginning with
_is not content:_category.md,_authors/, a_features.mdpartial another file includes.
Summary
Functions
The categories above a slug, outermost first, then the guide or category itself. Empty for a slug the tree does not hold.
Every category, depth first.
A category by slug.
A guide by slug. A category's own page answers to the category's slug.
Every guide in reading order: a category's own page, then its children.
{previous, next} in reading order, either possibly nil.
Read a collection root into an ordered tree.
Types
@type doc() :: %{ type: :doc, slug: String.t(), path: Path.t(), dir: String.t(), title: String.t(), label: String.t(), summary: String.t(), description: String.t() | nil, image: String.t() | nil, keywords: [String.t()], icon: String.t(), position: integer() | nil, category: String.t() | nil, index?: boolean(), meta: Gamend.Content.Frontmatter.meta() }
Functions
The categories above a slug, outermost first, then the guide or category itself. Empty for a slug the tree does not hold.
Every category, depth first.
A category by slug.
A guide by slug. A category's own page answers to the category's slug.
Every guide in reading order: a category's own page, then its children.
{previous, next} in reading order, either possibly nil.
Read a collection root into an ordered tree.