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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Osirion.Blazor.Cms" Version="2.1.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Osirion.Blazor.Cms" Version="2.1.3" />
                    
Directory.Packages.props
<PackageReference Include="Osirion.Blazor.Cms" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Osirion.Blazor.Cms --version 2.1.3
                    
#r "nuget: Osirion.Blazor.Cms, 2.1.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Osirion.Blazor.Cms&version=2.1.3
                    
Install Osirion.Blazor.Cms as a Cake Addin
#tool nuget:?package=Osirion.Blazor.Cms&version=2.1.3
                    
Install Osirion.Blazor.Cms as a Cake Tool

Osirion.Blazor.Cms

NuGet License

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 and LocalizedContentView 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last updated
2.1.3 59 5/31/2025
2.1.2 66 5/31/2025
2.1.1 138 5/20/2025
2.1.0 139 5/19/2025
2.0.2 151 4/23/2025
2.0.1 162 4/23/2025
2.0.0 166 4/22/2025