Routing & Directory Structure
Linx Books relies on a strict, predictable mapping between your physical file directory structure inside the content/ folder and the client-side router/sidebar navigation tree. This eliminates the need for manual route configuration.
1. Document Groups (First-Level Folders)
Every first-level folder inside the content/ directory represents a Document Group.
- Example:
/content/getting-started/maps to the/getting-startedpath. - In the homepage catalog, each first-level folder is represented as a card.
- If a group folder contains an
index.mdfile, its content is rendered as the landing page of that group.
2. Page Routing
Any Markdown file inside a group folder maps directly to a nested path.
- File path:
/content/getting-started/configuration.md - Route URL:
/getting-started/configuration
Nested subdirectories represent collapsible folder categories in the sidebar.
3. Collapsible Categories
To create a nested, collapsible group of documents in the sidebar:
- Create a subdirectory under your main group (e.g.,
/content/getting-started/advanced/). Add an
index.mdfile in that subfolder. The frontmatter of this file specifies the category's title and display order:yaml--- title: Advanced Topics order: 10 ---- Add child markdown files inside the subfolder. They will automatically be parsed and rendered under the collapsible category list.
4. Sorting Rules
Sidebar items (both individual pages and nested category folders) are ordered deterministically:
- Sort by
ordermetadata: If anordernumber is specified in a file's frontmatter, it takes precedence. Lower numbers appear first in the sidebar. Alphabetical Fallback:
- Root-level folders/pages: Sorted alphabetically by their display title if no
orderis provided or if they are equal. - Child pages in subfolders: Sorted alphabetically by their file name (e.g.,
setup.mdbeforeusage.md).
- Root-level folders/pages: Sorted alphabetically by their display title if no
5. Prev/Next Navigation Sibling Links
The system automatically scans the sorted list of pages inside a Document Group and appends previous/next navigation buttons at the bottom of each document page.
- Sibling navigation is fully scoped within the active Document Group.
- This ensures users can read through documentation sequentially like a book without getting lost.