SyntaxCircus.Blazor.Seo
0.1.3
See the version list below for details.
dotnet add package SyntaxCircus.Blazor.Seo --version 0.1.3
NuGet\Install-Package SyntaxCircus.Blazor.Seo -Version 0.1.3
<PackageReference Include="SyntaxCircus.Blazor.Seo" Version="0.1.3" />
<PackageVersion Include="SyntaxCircus.Blazor.Seo" Version="0.1.3" />
<PackageReference Include="SyntaxCircus.Blazor.Seo" />
paket add SyntaxCircus.Blazor.Seo --version 0.1.3
#r "nuget: SyntaxCircus.Blazor.Seo, 0.1.3"
#:package SyntaxCircus.Blazor.Seo@0.1.3
#addin nuget:?package=SyntaxCircus.Blazor.Seo&version=0.1.3
#tool nuget:?package=SyntaxCircus.Blazor.Seo&version=0.1.3
SyntaxCircus.Blazor.Seo
SEO building blocks for Blazor Server marketing sites — meta/OG/Twitter tags, typed Schema.org JSON-LD, a canonical URL builder, a generic sitemap.xml/robots.txt endpoint, and canonical-host redirect middleware.
No support guaranteed. Published as-is and maintained on a best-effort basis. Issues and PRs are welcome, but there's no SLA — fork it or vendor what you need if that's not enough.
Setup
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSyntaxCircusSeo(builder.Configuration); // binds "Seo" and "Support"
var app = builder.Build();
app.UseCanonicalHost(); // optional — 301s non-canonical hosts to Seo:BaseUrl's host
app.MapSitemap(
staticEntries:
[
new SitemapEntry(builder.Configuration["Seo:BaseUrl"] + "/", DateTime.UtcNow, "weekly", 1.0),
new SitemapEntry(builder.Configuration["Seo:BaseUrl"] + "/about", DateTime.UtcNow),
],
dynamicEntriesProvider: async (services, ct) =>
{
var catalog = services.GetRequiredService<IMyCatalogService>();
return catalog.GetEntries().Select(e => new SitemapEntry($"{baseUrl}/items/{e.Slug}", e.UpdatedAt)).ToArray();
});
app.MapRobotsTxt();
Configuration
| Section | Purpose |
|---|---|
Seo |
BaseUrl, SiteName, DefaultDescription, DefaultOgImage, DefaultLocale, TwitterHandle, LogoUrl, SameAs |
Support |
Optional site support/contact info — Email, IssueTrackerUrl, IssueTemplateUrl, OwnerContactUrl, OwnerDisplayName |
Per-page meta tags
<SeoHead
Title="Pricing"
Description="Plans and pricing."
RelativeUrl="/pricing"
StructuredData="PageSchemas" />
@code {
private IReadOnlyList<object> PageSchemas =>
[
new OrganizationSchema(
Name: "Acme",
Url: "https://acme.example",
Logo: "https://acme.example/logo.png"),
new BreadcrumbListSchema(
[new BreadcrumbItem(1, "Home", "https://acme.example/"), new BreadcrumbItem(2, "Pricing", "https://acme.example/pricing")]),
];
}
SeoHead sets the document title and fills in description, canonical link, robots directives, and Open Graph/Twitter tags from SeoOptions plus whatever you override per-page. Its optional StructuredData parameter renders each supplied object as a JSON-LD block in the document head. JsonLd remains available when you prefer to place a single schema directly; both accept typed records from Schemas.cs (OrganizationSchema, WebSiteSchema, PersonSchema, CreativeWorkSchema, SoftwareApplicationSchema, BookSchema, BreadcrumbListSchema, FaqPageSchema) or your own POCO.
Notes
MapSitemap/MapRobotsTxtdon't assume output caching is configured — if your app hasAddOutputCache()/UseOutputCache()set up, chain.CacheOutput(...)onto the returned endpoint builder yourself.ISeoUrlBuilder(injectable) resolves relative URLs againstSeo:BaseUrland can compute the canonical URL for the current request.
Contributing
Issues and pull requests are welcome:
- Keep changes focused, with a clear description of the behavior change.
- Match the existing code style (see
.editorconfig). - Call out any breaking changes to the public API in your PR description.
License
MIT — see LICENSE.txt.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.