Write

Write clear, scannable MDX pages with structure, links, and media, then verify in preview.

Before you begin

  • A docs.page project with docs.json at the repository root and page files under docs/
  • Basic Markdown familiarity: headings, lists, links, and fenced code blocks

Write a new page

Each page is a .mdx or .md file under docs/. Work through these steps in order:

  1. Choose a URL path: add docs/{path}.mdx (or .md). The path without the extension becomes the URL.
  2. Declare title and description: set title and description in YAML frontmatter at the top of the file. See Frontmatter.
  3. Make the page scannable: structure the body with ## headings and short paragraphs. See Page structure and prose.
  4. Help readers follow along: add root-relative links, fenced code blocks, and images where they clarify the task. See Links and assets.
  5. Expose the page to readers: add it to the sidebar in Organize, then confirm in Preview.

Page structure and prose

Structure the body with ## headings. The On this page table of contents derives from Markdown heading levels, keep one main idea per section and nest subsections one level deeper. Set content.headerDepth in docs.json when you need deeper entries in that list.

Write so a busy reader can skim: state the outcome first, keep paragraphs short, use imperative voice (Run, Set, Open), and bold UI labels while putting commands and paths in backticks.

Match page shape to what the reader needs:

Reader goalPage shapeLink out for
Learn by doingStep-by-step walkthroughField lookup, API tables
Complete one taskFocused how-to with a verify stepArchitecture essays
Look up a valueReference tables or property rowsTutorial narrative
Understand whyExplanation with a mental modelNumbered setup steps

Stay in one mode per page. Link to Reference and Components instead of mixing exhaustive lists into prose.

Frontmatter

Start each page with YAML frontmatter between --- delimiters:

yaml
---
title: Install the CLI
description: Install the docs.page CLI on macOS, Linux, or Windows.
---

At minimum, set title and description. Additional keys control redirects, previous/next links, hero images, and indexing, see Page frontmatter.

Where pages live

Store every page under docs/. The file path (without the extension) becomes the URL path:

FileURL
docs/index.mdx/
docs/getting-started.mdx/getting-started
docs/api/authentication.mdx/api/authentication

Create a new file when you add a topic. Rename the file and add a redirect when you move a published URL.

Links and assets

Internal links: use root-relative paths with no domain and no .mdx extension:

mdx
See [Preview](/authoring/preview) before you open a pull request.

Code examples: wrap snippets in fenced blocks with a language tag (bash, json, tsx). For multiple equivalent snippets, use a code group or tabs. See Code blocks for titles and diff markers.

Images: commit under docs/ and reference with a leading slash (/assets/dashboard.png). Use <Image> when you need captions, light/dark variants, zoom behavior, or sizing, see content.zoomImages in docs.json.

Video and embeds: <YouTube>, <Vimeo>, <Video> (public https URL only), or <Tweet>.

When to use components

Plain Markdown covers most writing. docs.page also ships built-in MDX components with no imports and no extra packages.

Reader needStart with
Body copy and listsPlain Markdown
One highlighted snippetFenced code block
Platform or language variants<Tabs> or <CodeGroup>
Prerequisites, cautions, tips<Info>, <Warning>, or siblings
Collapsible sections<Accordion> and <AccordionGroup>
Numbered setup flow<Steps>
Custom heading anchorsMarkdown ## headings (recommended) or <Heading>
Inline icons<Icon>
API or config field rows<Property> on Reference pages
Section landing links<Card> and <CardGroup>

Author components with PascalCase JSX tags. Unknown names show an inline error in preview, match the tag to the Components reference. For props and examples, use the Components tab; for how the library fits the product, see Features → Components.

After you edit, use Preview to confirm layout, run docs check for broken links, then continue to Publish.

Troubleshooting

SymptomLikely causeFix
Page returns 404 in previewFile is outside docs/ or the path does not match the URL you openedKeep pages under docs/ and match the file path to the URL (no extension)
Internal link goes nowhereLink includes a domain, file extension, or wrong pathUse root-relative paths like /authoring/preview. No https:// and no .mdx.
Image does not renderAsset path is wrong or the file is not committedStore images under docs/ and reference them with a leading slash, e.g. /assets/screenshot.png
Inline component error in previewMisspelled or unsupported component nameMatch the tag to the Components reference. Names are PascalCase.
{{ variable }} shows literallySubstitution used in frontmatter or the path is undefinedUse variables in the MDX body only; define values in docs.json. See Global variables or docs.json: variables.

Related

Organize
Organize

Add the page to sidebar groups, tabs, and navigation order in docs.json.

Preview
Preview

Iterate locally with live reload while you edit.

Components overview
Components overview

Look up every built-in component, prop, and example.

Components feature
Components feature

How global MDX components work in preview and production.

Global variables
Global variables

Reuse version numbers and URLs across pages from docs.json.

Table of contents
Table of contents

How the on-page heading list is built and how content.headerDepth works.

Page frontmatter
Page frontmatter

Field reference for title, description, redirects, and more.