Skip to content
Subs -30% SUB30
> docs/how-docs-work

How the Docs System Works

5 min read Meta Last updated March 07, 2026

Behind the Scenes

This page explains how the OpenClaw documentation system works internally. It is intended for contributors who want to add or update documentation, and for anyone curious about the technical implementation.

ClawHosters Documentation System

Markdown Files

All documentation is written as Markdown files stored in the repository under:

text
content/openclaw/docs/
├── en/              # English documentation
│   ├── overview/
│   ├── getting-started/
│   ├── instances/
│   ├── channels/
│   ├── configuration/
│   ├── addons/
│   ├── billing/
│   ├── advanced/
│   ├── security/
│   ├── troubleshooting/
│   ├── use-cases/
│   ├── support/
│   └── meta/
└── de/              # German documentation
    ├── overview/
    ├── getting-started/
    ├── instances/
    ├── channels/
    ├── configuration/
    ├── addons/
    ├── billing/
    ├── advanced/
    ├── security/
    ├── troubleshooting/
    ├── use-cases/
    ├── support/
    └── meta/

Each documentation page exists as two files: one in en/ and one in de/. Both versions need the same slug and category.

YAML Frontmatter

Every Markdown file starts with a YAML frontmatter block that defines metadata:

yaml
---
title: Page Title
slug: page-slug
category: getting-started
section: Getting Started
position: 3
---
Field Required Description
title Yes Display title of the page (localized)
slug Yes URL identifier, must match between EN and DE versions
category Yes Directory name (overview, getting-started, instances, channels, configuration, addons, billing, advanced, security, troubleshooting, use-cases, support, meta)
section Yes Display name for the category (localized: "Advanced" in EN, "Erweitert" in DE)
position Yes Sort order within the category (lower numbers appear first)

Category and Section Mapping

Category (directory) English Section German Section
overview Overview Überblick
getting-started Getting Started Erste Schritte
instances Instances Instanzen
channels Channels Kanäle
configuration Configuration Konfiguration
addons Addons Addons
billing Billing Abrechnung
advanced Advanced Erweitert
security Security Sicherheit
troubleshooting Troubleshooting Fehlerbehebung
use-cases Use Cases Anwendungsfälle
support Support Support
meta Meta Meta

Document Sync Process

Documentation files are synced to the database through the DocumentSyncService. This service:

  1. Scans the content/openclaw/docs/ directory for Markdown files
  2. Parses YAML frontmatter from each file
  3. Converts Markdown content to HTML
  4. Calculates an estimated reading time
  5. Generates a vector embedding for semantic search
  6. Stores everything in the database

The Sync Flow

text
Markdown file on disk
  → System reads the file
  → YAML frontmatter parsed for metadata
  → Markdown body converted to HTML
  → Reading time calculated from word count
  → Text sent to embedding API (4096 dimensions)
  → Record stored in database

Database Record Fields

Each synced document creates a record with:

Field Source
file_path Relative path from Rails root
document_type Always "docs" for documentation
locale "en" or "de" from directory path
slug From frontmatter
category From frontmatter
title From frontmatter
content_html Markdown converted to HTML
readingtimeminutes Estimated from word count
embedding 4096-dimension vector from embedding API

Semantic Search with pgvector

The documentation system uses vector embeddings to enable semantic search. When a user asks a question, the system:

  1. Converts the question into a vector embedding using the same embedding model
  2. Queries the documentation database using vector similarity search
  3. Returns the most relevant documentation pages ranked by similarity

This means users can find documentation by describing what they need in natural language, instead of needing exact keywords or page titles.

Text search finds exact or fuzzy word matches. Searching for "server won't start" would only find pages containing those specific words.

Vector search understands meaning. Searching for "server won't start" would also find pages about "instance not running" or "deployment failure" because the concepts are semantically similar.

Linking Between Pages

Documentation pages link to each other using the /docs/slug format:

markdown
See the [Architecture Overview](/docs/architecture) for more details.

The slug in the URL must match the slug field in the target page's frontmatter. Links work across locales. The system resolves the correct localized version based on the reader's language setting.

Adding New Documentation

To add a new documentation page:

  1. Create the English file in the appropriate category directory
  2. Create the German file in the matching DE category directory
  3. Set matching slugs. Both files must have the same slug value
  4. Choose a position. Pick a number that places the page in the correct sort order within its category
  5. Write the content. Use standard Markdown with headings, tables, code blocks, and lists
  6. Add a Related Docs section. Link to other relevant pages at the bottom

File Naming Convention

Use the slug as the filename with a .md extension:

text
content/openclaw/docs/en/advanced/my-new-page.md
content/openclaw/docs/de/advanced/my-new-page.md

Both files would have slug: my-new-page in their frontmatter.

Content Guidelines

  • Write in clear, direct language
  • Use headings to organize content (start with ##, not #)
  • Include code examples where helpful
  • Add tables for comparing options or listing configurations
  • End each page with a "Related Docs" section linking to related pages
  • Do not include unverifiable claims or made-up statistics

German Translation Notes

The German version should be a natural German translation, not a word-for-word conversion:

  • Use proper German umlauts (ä, ö, ü, ß), never ae, oe, ue, ss substitutions
  • Localize the title and section fields
  • Keep technical terms (Docker, API, SSH) unchanged
  • Translate code comments if they contain user-facing text
  • Use "du" (informal) for addressing the reader

Quality Assurance

The documentation system includes automated checks that verify:

  1. Each Markdown file contains all required frontmatter fields
  2. Slugs are unique and consistent between language versions
  3. Files sync successfully to the database
  4. Content is properly formatted and accessible

Related Documentation