Skip to content

Latest commit

 

History

History
53 lines (35 loc) · 1.18 KB

README.md

File metadata and controls

53 lines (35 loc) · 1.18 KB

Blazor.Sitemap

NuGet NuGet

Sitemap generator for Blazor.

Installation

Install Blazor.Sitemap with NuGet:

Install-Package Blazor.Sitemap

Or via the .NET Core command line interface:

dotnet add package Blazor.Sitemap

Usage

Map endpoint

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();

var app = builder.Build();

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();

app.MapControllers();
app.MapBlazorHub();
app.MapSitemap("https://pablofrommars.github.io"); //Adjust for your url
app.MapFallbackToPage("/_Host");

app.Run();

Annotate your pages

@page "/"
@attribute [SitemapUrl(changeFreq: ChangeFreq.Daily, priority: 1.0)]
@page "/contact"
@attribute [SitemapUrl(changeFreq: ChangeFreq.Monthly, priority: 0.5)]