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. Commit the changes
Commit your changes to the main branch to see how your page looks. To see your docs, follow the example below:
Repository name | Documentation URL |
---|---|
myCompany-docs | myCompany.docs.writedocs.io |
docs-myCompany | myCompany.docs.writedocs.io |
Our team is working hard to provide a CLI that will enable you to quickly preview your docs. For now, please wait about 2 minutes to see the changes in your portal.