Osirion.Blazor.Cms
2.1.3
dotnet add package Osirion.Blazor.Cms --version 2.1.3
NuGet\Install-Package Osirion.Blazor.Cms -Version 2.1.3
<PackageReference Include="Osirion.Blazor.Cms" Version="2.1.3" />
<PackageVersion Include="Osirion.Blazor.Cms" Version="2.1.3" />
<PackageReference Include="Osirion.Blazor.Cms" />
paket add Osirion.Blazor.Cms --version 2.1.3
#r "nuget: Osirion.Blazor.Cms, 2.1.3"
#addin nuget:?package=Osirion.Blazor.Cms&version=2.1.3
#tool nuget:?package=Osirion.Blazor.Cms&version=2.1.3
Osirion.Blazor.Cms
Content management components for Blazor applications with multiple provider support, localization, and SEO optimization.
Features
- Multiple Content Providers: GitHub and FileSystem implementations included
- Provider Pattern: Easily extend with custom providers
- Localization: Full support for multi-language content with translations
- SEO Optimization: Rich snippets, structured data, and comprehensive metadata
- Directory Navigation: Hierarchical content browsing with metadata
- Markdown Support: Built-in Markdown rendering with frontmatter
- SSR Compatible: Works with Server-Side Rendering and Static SSG
- Caching: Efficient content delivery with built-in caching
- Content Organization: Categories, tags, and directory-based navigation
- Search: Full-text content search capabilities
Installation
dotnet add package Osirion.Blazor.Cms
Usage
Quick Start
// In Program.cs
using Osirion.Blazor.Cms.Extensions;
builder.Services.AddOsirionContent(content => {
content.AddGitHub(options => {
options.Owner = "username";
options.Repository = "content-repo";
options.ContentPath = "content";
options.Branch = "main";
});
});
@using Osirion.Blazor.Cms.Components
<ContentList />
<ContentView Path="blog/my-post.md" />
<CategoriesList />
<TagCloud />
<SearchBox />
<DirectoryNavigation />
<LocalizedNavigation CurrentLocale="en" />
<LocalizedContentView Path="blog/my-post.md" CurrentLocale="en" />
<SeoMetadataRenderer Content="@CurrentContent" SiteName="My Website" BaseUrl="https://mysite.com" />
File System Provider
builder.Services.AddOsirionContent(content => {
content.AddFileSystem(options => {
options.BasePath = "wwwroot/content";
options.WatchForChanges = true;
});
});
Localization Support
The CMS module has built-in support for multi-language content. You can enable or disable localization as needed:
// With localization enabled (default)
builder.Services.AddOsirionContent(content => {
content.AddGitHub(options => {
options.Owner = "username";
options.Repository = "content-repo";
options.EnableLocalization = true; // Default is true
options.DefaultLocale = "en"; // Default locale
});
});
// Disable localization
builder.Services.AddOsirionContent(content => {
content.AddGitHub(options => {
options.Owner = "username";
options.Repository = "content-repo";
options.EnableLocalization = false; // Disable localization
});
});
When localization is enabled:
- Content is organized by locale in directories (e.g., "en/blog", "fr/blog")
- Translations are linked using
localization_id
in frontmatter - The
LocalizedNavigation
andLocalizedContentView
components show language selectors
<LocalizedNavigation
CurrentLocale="@CurrentLocale"
OnLocaleChanged="@HandleLocaleChanged"
EnableLocalization="true" />
<LocalizedContentView
Path="@ContentPath"
CurrentLocale="@CurrentLocale"
EnableLocalization="true" />
Content Queries
@inject IContentProvider ContentProvider
@code {
private async Task LoadContentAsync()
{
// Get all content items
var allItems = await ContentProvider.GetAllItemsAsync();
// Get content by directory
var blogPosts = await ContentProvider.GetItemsByQueryAsync(new ContentQuery {
Directory = "blog"
});
// Get content by category
var tutorials = await ContentProvider.GetItemsByQueryAsync(new ContentQuery {
Category = "tutorials"
});
// Get content by tag
var blazorPosts = await ContentProvider.GetItemsByQueryAsync(new ContentQuery {
Tag = "blazor"
});
// Search content
var searchResults = await ContentProvider.GetItemsByQueryAsync(new ContentQuery {
SearchQuery = "blazor components"
});
// Get featured content
var featured = await ContentProvider.GetItemsByQueryAsync(new ContentQuery {
IsFeatured = true
});
// Sort content
var recentFirst = await ContentProvider.GetItemsByQueryAsync(new ContentQuery {
SortBy = SortField.Date,
SortDirection = SortDirection.Descending
});
}
}
Markdown Frontmatter
---
title: "My Blog Post"
author: "John Doe"
date: "2025-04-20"
description: "A brief description of my post"
tags: [blazor, webassembly, dotnet]
categories: [tutorials, web]
slug: "my-blog-post"
is_featured: true
featured_image: "https://example.com/image.jpg"
---
# My Blog Post Content
Your markdown content here...
Creating Custom Providers
public class CustomProvider : ContentProviderBase
{
public CustomProvider(ILogger<CustomProvider> logger, IMemoryCache memoryCache)
: base(logger, memoryCache)
{
}
public override string ProviderId => "custom";
public override string DisplayName => "Custom Provider";
public override bool IsReadOnly => true;
public override Task<IReadOnlyList<ContentItem>> GetAllItemsAsync(CancellationToken cancellationToken = default)
{
// Your implementation
}
public override Task<ContentItem?> GetItemByPathAsync(string path, CancellationToken cancellationToken = default)
{
// Your implementation
}
public override Task<IReadOnlyList<ContentItem>> GetItemsByQueryAsync(ContentQuery query, CancellationToken cancellationToken = default)
{
// Your implementation
}
}
// Register the provider
builder.Services.AddOsirionContent(content => {
content.AddProvider<CustomProvider>();
});
Documentation
For more detailed documentation, see GitHub CMS Documentation.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Markdig (>= 0.41.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.Http (>= 8.0.1)
- Osirion.Blazor.Cms.Admin (>= 2.1.3)
- Osirion.Blazor.Cms.Web (>= 2.1.3)
-
net9.0
- Markdig (>= 0.41.0)
- Microsoft.Extensions.Caching.Memory (>= 9.0.5)
- Microsoft.Extensions.Http (>= 9.0.5)
- Osirion.Blazor.Cms.Admin (>= 2.1.3)
- Osirion.Blazor.Cms.Web (>= 2.1.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Osirion.Blazor.Cms:
Package | Downloads |
---|---|
Osirion.Blazor
Modern, high-performance Blazor components and utilities. Features SSR-compatible components for navigation, analytics, content management, and theming with seamless CSS framework integration. |
GitHub repositories
This package is not used by any popular GitHub repositories.