Skip to main content

MDX Pages

In your WriteDocs project, each page is an MDX file. To create MDX pages and display them on the sidebar, follow these steps:

Step 1. Create an MDX file

Create an MDX file in your docs repository, such as introduction.mdx. You can also create folders with multiple MDX files to group related pages into a category.

Step 2. Set the header configuration

Each MDX file begins with metadata enclosed between triple dashes (---) at the start and end.

---
title: Page Configuration
slug: /page-configuration
description: Learn how to make your documentation easy to navigate for users and optimized for search engines.
---

Attributes

title string required
The title that will appear on the page and sidebar. If you want the title on the page to differ from the sidebar, add it as a Heading 1.

slug string
The page slug. If this attribute is not specified, WriteDocs will use the MDX page name along with the file path.

description string
The page description used for SEO optimization.

Step 3. Refer the page on the config.json

Reference the page in the sidebar object of the config.json file. As mentioned in the Global Settings, add the pages within the pages array of strings and/or objects, attaching them to a category inside the sidebarRef name.

{
...
"sidebars": [
{
"sidebarRef": "guides",
"categories": [
{
"categoryName": "Getting Started",
"pages": [
"getting-started/overview",
{
"page": "getting-started/quickstart/quickstart",
"groupName": "Quickstart",
"subpages": [
"getting-started/quickstart/beginners-guide"
]
},
"getting-started/global-settings"
]
}
]
}
]
}

Step 4. Preview your Changes

Run the following command of our CLI to preview your changes in the local host.

writedocs dev

Step 5. Commit the Changes

Commit and push your changes to the main branch to see how your endpoint pages look published. To see your docs, follow the example below:

Repository nameDocumentation URL
myCompany-docsmyCompany.docs.writedocs.io