Your first site
Create a docs root, write a page, and see it in the browser.
This walks through creating a minimal SharpDocs site from scratch. Assumes you've already installed the package.
1. Create the docs root
Pick a folder — site/ is the convention:
MyApp/
Program.cs
appsettings.json
site/
sharpdocs.json structural
site.json base content (title, sidebar)
index.md page
2. Write sharpdocs.json
The structural file. Required. Declares which locales your site ships and where the artifacts live.
{
"github": "https://github.com/you/my-library",
"defaultLocale": "en",
"locales": ["en"]
}
A single-locale site is fine — just list one locale. You can add more later by dropping site.{locale}.json overlays + *.{locale}.md page overlays alongside the base files. See Localization.
3. Write site.json
The base content file. Required. Declares the site title and the sidebar.
{
"title": "My library",
"description": "A small library.",
"sidebar": [
{
"label": "Overview",
"items": [
{ "label": "Introduction", "slug": "index" }
]
}
]
}
Every slug in the sidebar must correspond to a markdown file. If index is the slug, you need index.md. Missing slugs degrade the locale at startup.
4. Write a page
site/index.md:
---
title: My library
description: A small library.
---
Welcome.
## Quick start
Install the package and get going.
5. Run it
dotnet run
Open the site at whatever port your host uses. / redirects to /{defaultLocale} (e.g. /en), article pages are at /{locale}/{slug}, and /{locale}/search?q=foo returns results.
(Multi-project sites use a different URL shape — /docs/{projectId}/{locale}/{slug} and /docs/{projectId}/{locale}/search. See Multi-project setup.)