Configuration
Every ShellDocs site configures itself through AddShellDocs(o => { … }) in Program.cs. The options object is where you set the site name, wire the header nav, declare your package family for the sidebar selector, drop in a brand logo, choose a layout variant, and register components for markdown authors to reference inline.
The minimum
csharp
builder.Services.AddShellDocs(o =>
{
o.ContentRoot = Path.Combine(builder.Environment.ContentRootPath, "content");
o.SiteName = "MyDocs";
o.GitHubRepo = "my-org/my-docs";
});
That's a working site. AddShellDocs registers all the shipped content primitives automatically (Callout, Card, Steps, FileTree, CodeGroup, TypeTable, ComponentPreview) : you don't need to opt in.
The full surface
Site metadata
| Prop | Type | Default | Description |
|---|---|---|---|
SiteNameRequired |
string |
— | Brand name shown in the header and sidebar. |
SiteTagline |
string? |
null |
One-line description shown in the footer. |
GitHubRepo |
string? |
null |
|
ContentRoot |
string |
— | Path to the content folder. Almost always set to `Path.Combine(builder.Environment.ContentRootPath, \ |
Layout
| Prop | Type | Default | Description |
|---|---|---|---|
LayoutVariant |
DocsLayoutVariant |
TopNav |
`TopNav` = classic header + sidebar. `Sidebar` = floating card sidebar (this site uses it). |
csharp
o.LayoutVariant = DocsLayoutVariant.Sidebar;
Header navigation
| Prop | Type | Default | Description |
|---|---|---|---|
AddNavLink(label, href) |
fluent |
— | Simple link in the primary nav. |
AddNavMenu(label, items[]) |
fluent |
— | Hover mega-menu with icon-labelled child links. |
csharp
o.AddNavLink("Docs", "/docs/introduction");
o.AddNavLink("Components", "/docs/components/callout");
o.AddNavMenu("Learn",
new NavMenuItem("Getting Started", "/docs/getting-started/installation", "Install and scaffold your first site."),
new NavMenuItem("Authoring", "/docs/authoring/markdown", "How the markdown pipeline works."));
Sidebar package selector
| Prop | Type | Default | Description |
|---|---|---|---|
AddPackage(id, title, description, rootUrl, iconPath?) |
fluent |
— | Declares one package family entry. Selector renders in the sidebar when 2+ packages are declared; hides entirely when 0 or 1. |
csharp
o.AddPackage("shellui.components", "ShellUI.Components", "Widgets and primitives.", "/docs/components/button");
o.AddPackage("shellui.blocks", "ShellUI.Blocks", "Page-level blocks.", "/docs/blocks/hero");
o.AddPackage("shellui.charts", "ShellUI.Charts", "Data visualisation.", "/docs/charts/line");
Brand logo
| Prop | Type | Default | Description |
|---|---|---|---|
LogoSvg |
string? |
null |
|
LogoLight / LogoDark |
string? |
null |
URL pair for pre-rasterized theme-specific logos. Use when you have full-color logos with hardcoded palettes. |
LogoAlt |
string? |
SiteName |
Accessibility label for the logo image. |
LogoHeight |
double |
1.375 |
Height in rem. Applied as inline style. |
SetLogo(url) |
fluent |
— | Convenience : same URL for both themes. |
SetLogo(light, dark, alt?) |
fluent |
— | Convenience : set both themes at once. |
csharp
// Monochrome mark (recommended for stroke logos):
o.LogoSvg = File.ReadAllText(Path.Combine(builder.Environment.WebRootPath, "brand/logo.svg"));
// Or the URL path:
o.SetLogo("/img/logo-light.svg", "/img/logo-dark.svg", alt: "MyBrand");
Registering components
By default AddShellDocs registers ShellDocs' own content primitives. To let markdown authors reference your components in razor:preview blocks and <ComponentPreview>:
| Prop | Type | Default | Description |
|---|---|---|---|
RegisterComponent<T>() |
fluent |
— | Explicit single-component registration. |
RegisterComponentsFromAssembly<TMarker>(filter?) |
fluent |
— | Bulk-register every public ComponentBase subclass in TMarker's assembly. Optional filter predicate. |
[ShellDocsIgnore] |
attribute |
— | Opt-out marker for public components that shouldn't be reachable from markdown. |
csharp
// One line to expose an entire component library:
o.RegisterComponentsFromAssembly<ShellUI.Components.Button>();
// Or scoped:
o.RegisterComponentsFromAssembly(typeof(ShellUI.Components.Button).Assembly,
t => t.Namespace?.StartsWith("ShellUI.Components") == true);
Full example : this site's Program.cs
csharp
builder.Services.AddShellDocs(o =>
{
o.ContentRoot = Path.Combine(builder.Environment.ContentRootPath, "content");
o.SiteName = "ShellDocs";
o.SiteTagline = "The docs framework for .NET.";
o.GitHubRepo = "shellui-dev/shelldocs";
o.LayoutVariant = DocsLayoutVariant.Sidebar;
o.AddNavLink("Docs", "/docs/introduction");
o.AddNavLink("Components", "/docs/components/callout");
o.AddNavLink("CLI", "/docs/cli/init");
o.AddPackage("shelldocs", "ShellDocs", "The framework.", "/docs/introduction");
o.AddPackage("shelldocs.markdown", "ShellDocs.Markdown", "The markdown pipeline.", "/docs/authoring/markdown");
o.AddPackage("shelldocs.core", "ShellDocs.Core", "Nav graph + search.", "/docs/configuration/registering-components");
o.AddPackage("shelldocs.cli", "ShellDocs.CLI", "The CLI.", "/docs/cli/init");
o.AddPackage("shelldocs.components","ShellDocs.Components","The primitives.", "/docs/components/callout");
});