Creating topics
In Docusaurus, content pages live under docs/. At 3di, we call each of those pages a topic.
This page explains how to create a topic file, where to save it, and which front matter this template expects.
Prerequisites
- You need a local version of the project on your PC.
For more information, see Getting started.
For a live preview, start a local server, and check the output in your browser.
Project structure
Topics always live under the docs/ folder at the repository root.
| Focument type | Location |
|---|---|
| Product / project docs for readers | docs/<section>/… — create a folder per section (for example docs/user-guide/) |
| Template how-to pages (this site) | docs/template-description/… |
| Shared reusable snippets (not standalone pages) | docs/_includes/ — see Reusing content with includes |
| Shared content variables (short strings) | docs/_variables/ — see Reusing content with variables |
Use lowercase folders and kebab-case file names: docs/user-guide/getting-started.mdx. That path becomes the URL and the doc ID used in sidebars.js.
Creating a topic
- Under
docs/, create the section folder if it doesn't exist yet (for exampledocs/user-guide/). - Create a new file with the
.mdxextension, for examplegetting-started.mdx. - At the top of the file, add front matter.
See Creating front matter. - Below the front matter, add a single top-level heading (
#) that matches the topic title, then write the body. - Save the file.
.mdx by defaultCreate new topics as .mdx files, even when you write plain Markdown inside them.
.mdx supports everything this template uses: front matter, admonitions, tabs, tables, HTML blocks, and imports. An .md file may work for very simple pages, but imports and some MDX features can fail or behave differently.
Example topic file
---
title: Getting started
description: Install the product and open the first workspace.
---
# Getting started
Welcome to the user guide. Follow the steps below to get started.
Resulting URL
The site URL is derived from the path under docs/ (no file extension):
docs/user-guide/getting-started.mdx → /docs/user-guide/getting-started
Creating front matter
Front matter is the YAML block between --- lines at the very top of the file. Use it to specify the page metadata.
| Field | Purpose |
|---|---|
title | Page title in the browser tab and search |
description | Short summary for search and link previews |
Example front matter
---
title: Getting started
description: Install the product and open the first workspace.
---
# Getting started
Adding the topic to the sidebar
To display the topic in the left-hand navigation, you need to add the topic to the sidebar.
For more information, see Sidebar and table of contents.
Previewing the topic locally
- From the repository root, run
npm start. - Open the URL shown in the terminal, usually
http://localhost:3000/. - Open the topic from the sidebar, or go directly to
/docs/…using the path from Resulting URL. - Confirm that the title, description (used later in the search), and body look correct.
- Before you push, optionally run
npm run build— this template fails the build on broken links (onBrokenLinks: 'throw').