RazorClassBlog 0.0.2
See the version list below for details.
dotnet add package RazorClassBlog --version 0.0.2
NuGet\Install-Package RazorClassBlog -Version 0.0.2
<PackageReference Include="RazorClassBlog" Version="0.0.2" />
<PackageVersion Include="RazorClassBlog" Version="0.0.2" />
<PackageReference Include="RazorClassBlog" />
paket add RazorClassBlog --version 0.0.2
#r "nuget: RazorClassBlog, 0.0.2"
#:package RazorClassBlog@0.0.2
#addin nuget:?package=RazorClassBlog&version=0.0.2
#tool nuget:?package=RazorClassBlog&version=0.0.2
RazorClassBlog
A lightweight, embeddable blog system for ASP.NET Core Razor Pages, delivered as a Razor Class Library (RCL).
About this project
RazorClassBlog exists to solve a very specific problem:
�I need a simple, SEO-friendly blog inside my existing ASP.NET Core site � not a full CMS, not a headless platform, and not a WordPress clone.�
This project provides:
- Public blog pages that search engines can crawl and index
- An optional admin UI for managing posts
- Clean architecture that lets the host application control authentication, identity, and data storage
It is designed to be:
- Embedded, not hosted
- Configurable, not opinionated
- Small, not over-engineered
If you want a full CMS, this probably isn�t it. If you want a blog that �just works� inside your app, it might be.
This was also a practical test to try an use AI (GPT5) to develop as much out of the box without tinkering as possible. So far its about 80% AI written, and 20% cleanup/re-structure.
Features
Public blog
- Blog index with pagination
- Individual post pages
- SEO-friendly URLs (
/blog/yyyy/mm/slug) - Breadcrumb navigation (HTML + JSON-LD)
- Canonical URLs and meta descriptions
- Structured data (BlogPosting / Article)
- Open Graph & Twitter Card metadata
Admin UI (optional)
- Create, edit, and delete posts
- Draft, published, and scheduled posts
- Publish scheduling (future dates)
- Autosave drafts
- Rich text editor (TinyMCE)
- Role-based access using ASP.NET Core Identity
Architecture
- Razor Class Library (RCL)
- Razor Pages UI
- Repository + service abstractions
- Entity Framework Core�based persistence
- Host-controlled database provider (SQL, Cosmos DB, etc.)
Technology
- Target framework: .NET 9
- UI: Razor Pages + Bootstrap
- Data: Entity Framework Core
- Auth: ASP.NET Core Identity
- Editor: TinyMCE (via CDN)
Installation
dotnet add package RazorClassBlog
Or reference the project directly during development.
Basic setup
Register services
builder.Services.AddBlogging(options =>
{
options.BlogKey = "main";
options.PublicPageSize = 5;
options.AdminPageSize = 25;
options.AdminRoles = new[] { "Admin", "BlogAdmin" };
options.ReaderRoles = new[] { "User", "Customer" };
// Disable admin UI on public-only sites
// options.EnableAdminUi = false;
});
Ensure Razor Pages, Identity, and Authorization are enabled:
builder.Services.AddRazorPages();
builder.Services.AddAuthorization();
Middleware:
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapRazorPages();
Database configuration
The library depends on an IBlogDbContext abstraction.
The host application supplies the concrete EF Core implementation.
Example (Cosmos DB):
builder.Services.AddDbContext<CosmosBlogDbContext>(options =>
options.UseCosmos(
builder.Configuration["Cosmos:ConnectionString"],
builder.Configuration["Cosmos:DatabaseName"]));
builder.Services.AddScoped<IBlogDbContext>(sp =>
sp.GetRequiredService<CosmosBlogDbContext>());
Admin UI & security
Admin pages
Admin pages live under:
/BlogAdmin
Access is controlled via ASP.NET Core Identity roles configured in BlogOptions.
Disable admin UI entirely
If the admin UI is hosted in a separate site, routes can be removed entirely:
options.EnableAdminUi = false;
When disabled:
- Admin routes are not registered
/BlogAdminreturns 404- No admin surface exists to attack
Publishing model
- Draft � not visible publicly
- Published � visible immediately
- Scheduled � visible when
PublishedUtc <= UtcNow
Public visibility rule:
Status == Published && PublishedUtc <= DateTimeOffset.UtcNow
Author handling
Posts support an editable display author:
- AuthorId � internal identifier (audit)
- AuthorName � displayed author (person or organization)
Examples:
- �Jane Doe�
- �Acme Marketing Team�
Non-goals
This project intentionally does not attempt to be:
- A full CMS
- A headless content platform
- A page builder
- A replacement for WordPress, Ghost, or similar systems
License
MIT License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net9.0
- Microsoft.EntityFrameworkCore (>= 9.0.11)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.