Linx logoLinx Docs
On this page
On this page
Page banner

Routing & Directory Structure

Learn how Linx Books automatically parses your folder structure into clean URLs and sidebar navigation.

Architecture

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-started path.
  • In the homepage catalog, each first-level folder is represented as a card.
  • If a group folder contains an index.md file, its content is rendered as the landing page of that group.
Directory Layout Example
content
getting-started
Document Group (ID: getting-started)
index.md
Group Landing Page
routing-structure.md
configuration.md
api-reference
Document Group (ID: api-reference)
index.md
Group Landing Page

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.

Nested Collapsible Folders
content
getting-started
advanced
Collapsible Folder Category
index.md
Category Index (provides category title/order)
security.md
Route: /getting-started/advanced/security
performance.md
Route: /getting-started/advanced/performance

3. Collapsible Categories

To create a nested, collapsible group of documents in the sidebar:

  1. Create a subdirectory under your main group (e.g., /content/getting-started/advanced/).
  2. Add an index.md file in that subfolder. The frontmatter of this file specifies the category's title and display order:

    yaml
    ---
    title: Advanced Topics
    order: 10
    ---
  3. 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:

  1. Sort by order metadata: If an order number is specified in a file's frontmatter, it takes precedence. Lower numbers appear first in the sidebar.
  2. Alphabetical Fallback:

    • Root-level folders/pages: Sorted alphabetically by their display title if no order is provided or if they are equal.
    • Child pages in subfolders: Sorted alphabetically by their file name (e.g., setup.md before usage.md).

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.