Write Content Doc
How to write documentation content
Section titled “How to write documentation content”This guide explains where documentation files live, how to organize them into folders and subfolders, and how to write the content itself.
Folder location
Section titled “Folder location”All documentation content lives in a single folder:
src/content/docs/Every .md or .mdx file inside this folder becomes a page in your documentation site. Subfolders become categories or URL segments.
Create a new folder for a category
Section titled “Create a new folder for a category”To group related articles, create a new folder inside src/content/docs/.
For example, to create a category for getting started guides:
src/content/docs/getting-started/The folder name becomes part of the URL for every article inside it.
Create a nested folder
Section titled “Create a nested folder”You can also create subfolders inside a category folder, to add another level of organization.
For example:
src/content/docs/getting-started/advanced/The structure can be as deep as you need. The URL reflects the folder path.
For example, an article at:
src/content/docs/getting-started/advanced/performance.mdWill be available at:
/getting-started/advanced/performance/Create a content article
Section titled “Create a content article”To add a new article, create a Markdown file inside the appropriate folder.
For example, to add an installation guide inside the getting-started folder:
src/content/docs/getting-started/installation.mdEvery article must start with a frontmatter block.
Frontmatter
Section titled “Frontmatter”Frontmatter defines the page metadata. At minimum, include a title and description.
---title: Your article titledescription: A short description of what this article covers.---
Write your content here using Markdown.titleappears as the page heading and in the sidebar.descriptionis used for SEO metadata and previews.
Keep both short and specific.
Register the folder in the sidebar
Section titled “Register the folder in the sidebar”Creating a folder does not automatically show it in the sidebar. You need to register it in astro.config.mjs.
You have two options.
Option 1: Auto-generate from a folder
Section titled “Option 1: Auto-generate from a folder”Use autogenerate to build the sidebar from a folder automatically. Every article inside will appear as a sidebar item.
{ label: 'Getting Started', autogenerate: { directory: 'getting-started' },}Option 2: List items manually
Section titled “Option 2: List items manually”If you want full control over labels and order, list each item manually.
{ label: 'Getting Started', items: [ { label: 'Installation', link: '/getting-started/installation/' }, { label: 'Configuration', link: '/getting-started/configuration/' }, ],}You can mix both approaches in the same sidebar.
Example: folder structure
Section titled “Example: folder structure”Here is an example folder layout for a documentation project.
src/content/docs/├── getting-started/│ ├── installation.md│ ├── configuration.md│ └── advanced/│ └── performance.md├── themes/│ ├── docuna.md│ └── astro-docus.md└── about.mdEach folder becomes a URL segment, and each .md file becomes a page.
Example: a complete article
Section titled “Example: a complete article”---title: Installationdescription: How to install and run Docuna on your machine.---
## Installation
Follow these steps to install Docuna.
### 1. Clone the repository
```bashgit clone https://github.com/your-username/docuna.git2. Install dependencies
Section titled “2. Install dependencies”npm install3. Start the development server
Section titled “3. Start the development server”npm run devYour site is now running at http://localhost:4321.
### Summary
- All content lives in `src/content/docs/`- Create folders and subfolders to group articles- Folder names become URL segments- Each article is a `.md` or `.mdx` file with frontmatter- Register folders in `astro.config.mjs` using `autogenerate` or manual items- Write the body with Markdown
Once you are comfortable with this structure, adding new categories or pages is as simple as creating a new folder or file.