Osirion.Blazor.Cms.Web renders Markdown content for visitors: lists, articles, navigation, head metadata, a sitemap
and feeds. The content comes from a provider that reads Markdown files with YAML front matter from a GitHub
repository or a local folder. Every component renders under static SSR, so pages work without script and are fully
indexable. This site is built with them.
Install
The Osirion.Blazor package includes the CMS modules and the AddOsirion setup methods:
dotnet add package Osirion.Blazor
To take only the content components, install
Osirion.Blazor.Cms.Web and register content with
AddOsirionContent from Osirion.Blazor.Cms.Web.DependencyInjection. Both target .NET 9 and .NET 10.
Register a content provider
Content from a folder in your project, configured in code:
using Osirion.Blazor.Extensions;
builder.Services.AddOsirion(osirion => osirion
.UseContent(content => content.AddFileSystem(options =>
{
options.BasePath = Path.Combine(builder.Environment.ContentRootPath, "content");
options.EnableLocalization = true;
options.SupportedLocales = ["en", "sr"];
})));
Content from a GitHub repository, configured in appsettings.json and read with
builder.Services.AddOsirion(builder.Configuration):
{
"Osirion": {
"Cms": {
"Web": {
"GitHub": {
"Blog": {
"Owner": "your-account",
"Repository": "your-content-repo",
"Branch": "main",
"ContentPath": "content",
"IsDefault": true
}
}
}
}
}
}
Each child of Osirion:Cms:Web:GitHub registers one provider. Keep ApiToken and WebhookSecret out of
appsettings.json; set them with user secrets or environment variables. A file system provider can be configured the
same way under Osirion:Cms:Web:FileSystem (with BasePath).
Then import the components, for example in _Imports.razor:
@using Osirion.Blazor.Cms.Web.Components
Write content
Each Markdown file starts with front matter in snake_case:
---
title: "Getting started"
description: "Install the package and render your first article."
author: "Jane Developer"
date: 2026-10-01
last_modified: 2026-10-08
featured_image: /images/getting-started.png
categories:
- Guides
tags:
- setup
slug: getting-started
published: true
---
# Getting started
An item's URL is its folder path below the content root plus its slug, without the locale folder when localization
is on. Other keys the
providers read include id (pairs translations), order, is_featured, lang, custom_fields and
seo_properties (title, description, canonical, robots, Open Graph and Twitter values, json_ld). From 4.0,
series and series_order group items into a series. A folder's _index.md describes the folder itself.
Markdown is rendered to HTML and sanitized against an allow-list when it is loaded, and the article components
sanitize again when they write it. Script, event handler attributes, javascript: URLs, forms, iframes and inline
SVG are removed. To allow an element your content needs, extend the list:
using Osirion.Blazor.Core.Extensions;
builder.Services.AddOsirionHtmlSanitizer(options => options.AllowElement("chart", "type", "data"));
Components
Core: ContentList, ContentView, LocalizedContentView, ContentPage, ContentRenderer, SeoMetadataRenderer and feeds and sitemap (from 4.0). See the core overview.
Navigation: CategoriesList, ContentBreadcrumbs, DirectoryNavigation, LocalizedNavigation, TagCloud, SearchBox, TableOfContents, OsirionContentNavigation and, from 4.0, ContentSeriesNavigation. See the navigation overview.
Pages and sections: ArticlePage, DocumentPage, HomePage and LandingPage render complete pages from an
item, and ContentSection, FeaturedPostsSection and OsirionContentListSection render blocks of content. Except
ArticlePage, these are in the Osirion.Blazor.Cms.Components namespace.
The editing interface is a separate package, Osirion.Blazor.Cms.Admin.
