Skip to content

Write Content Doc

This guide explains where documentation files live, how to organize them into folders and subfolders, and how to write the content itself.

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.

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.

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.md

Will be available at:

/getting-started/advanced/performance/

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.md

Every article must start with a frontmatter block.

Frontmatter defines the page metadata. At minimum, include a title and description.

---
title: Your article title
description: A short description of what this article covers.
---
Write your content here using Markdown.
  • title appears as the page heading and in the sidebar.
  • description is used for SEO metadata and previews.

Keep both short and specific.

Creating a folder does not automatically show it in the sidebar. You need to register it in astro.config.mjs.

You have two options.

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' },
}

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.

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.md

Each folder becomes a URL segment, and each .md file becomes a page.

---
title: Installation
description: How to install and run Docuna on your machine.
---
## Installation
Follow these steps to install Docuna.
### 1. Clone the repository
```bash
git clone https://github.com/your-username/docuna.git
Terminal window
npm install
Terminal window
npm run dev

Your 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.