Adding Content
How to Add Content to the DXKB Documentation Site
This page contains information on how to add content to the DXKB documentation site.
Adding a new page to the top-level
To add a new page, you need to create a new file in the content/docs directory.
For this example, we will add a new page called new-page.mdx.
Create the new page
Here is the content/docs directory before we add the new page:
Now, we will add the new page to the content/docs directory.
Note that all new pages should use the .mdx extension.
Here is the content/docs directory after we add the new page:
Add the new page to the meta.json file
Now in order to get the page to show up in the navigation, we need to add the page to the meta.json file.
Here is the meta.json file before we add the new page:
{
"title": "Docs",
"pages": ["contact", "new-page"],
"defaultOpen": false
}The pages list defines the order of the pages in the sidebar.
For more information on the meta.json file, please refer to the Fumadocs Documentation.
Adding a new folder with sub-pages
The process for adding a new folder with sub-pages is similar to adding a new page to the top-level, but with some additional steps.
Create a new folder
For this example, we will add a new folder called new-folder with one sub-page: sub-page-1.mdx.
This can be done in any directory within the content/docs directory, but for this example, we will just use the content/docs directory.
Create the new folder in the content/docs directory.
This folder will act as the root of the new folder.
Here is the content/docs directory BEFORE we add the new folder:
Here is the content/docs directory AFTER we add the new folder:
Add the sub-pages to the new folder
Now we need to add the sub-pages to the new folder. This is done by creating a new page in the new folder.
The name of the page is up to you, but it should be unique and descriptive.
For this example, we will add two sub-pages called sub-page-1.mdx and sub-page-2.mdx.
Here is the new-folder directory AFTER we add the sub-page:
Create 'index.mdx' in the new folder
Now we need to create an 'index.mdx' file in the new folder. This file will be the index page for the new folder.
Here is the new-folder directory AFTER we add the 'index.mdx' file:
The 'index.mdx' file will be the intial content that is displayed when you click on the folder in the sidebar. All 'index.mdx' files should use the following format:
---
title: Title of the Index Page
description: Description of the Index Page
---
# Index Page Header
This is the index page for the new folder.The title and description are used to display the title in the sidebar, or in other components such as the next and previous page footer.
Ensure that the --- title: description: --- block is the FIRST thing in the file, or else the page will not be displayed correctly.
Add the new page to the meta.json file
Now in order to get the page to show up in the navigation, we need to add the page to the meta.json file.
Here is the meta.json file BEFORE we add the new folder:
{
"title": "Docs",
"pages": ["contact"],
"defaultOpen": false
}Here is the meta.json file AFTER we add the new folder:
{
"title": "Docs",
"pages": ["contact", "new-folder"],
"defaultOpen": false
}While "new-folder" is not technically a page, it can be added to the "pages" list in the top-level meta.json file to be displayed in the navigation.
Add the sub-pages to the meta.json file in the new folder
Now we need to add the sub-pages to the meta.json file in the new folder.
Similar to the top-level meta.json file, this file will use the format filename: 'Navigation Title' inside the export default { ... } object to define pages inside the new folder.
Here is the meta.json file in the new-folder directory AFTER we add the sub-pages:
{
"title": "New Folder",
"pages": ["sub-page-1", "sub-page-2"],
"defaultOpen": false
}View the new pages!
You have successfully added a new folder with sub-pages to the DXKB documentation site!
Now you can view the new pages by navigating to the new folder in the navigation bar, well done!
For more information on how to add content to the DXKB documentation site, please refer to the Fumadocs Documentation page.
If you have more questions about adding content to the DXKB documentation site, please Contact Us.