https://github.com/soenneker/soenneker.gen.razor.sitemaps
Automatic sitemap generation for Razor apps at build time. Fast, deterministic, and zero-runtime overhead.
https://github.com/soenneker/soenneker.gen.razor.sitemaps
csharp dotnet externalgenerator gen generation generator razor razorsitemapgenerator sitemap sitemaps source
Last synced: 13 days ago
JSON representation
Automatic sitemap generation for Razor apps at build time. Fast, deterministic, and zero-runtime overhead.
- Host: GitHub
- URL: https://github.com/soenneker/soenneker.gen.razor.sitemaps
- Owner: soenneker
- License: mit
- Created: 2026-04-28T11:46:35.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-06-06T01:57:06.000Z (13 days ago)
- Last Synced: 2026-06-06T03:19:23.801Z (13 days ago)
- Topics: csharp, dotnet, externalgenerator, gen, generation, generator, razor, razorsitemapgenerator, sitemap, sitemaps, source
- Language: C#
- Homepage: https://soenneker.com
- Size: 90.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
[](https://www.nuget.org/packages/soenneker.gen.razor.sitemaps/)
[](https://github.com/soenneker/soenneker.gen.razor.sitemaps/actions/workflows/publish-package.yml)
[](https://www.nuget.org/packages/soenneker.gen.razor.sitemaps/)
#  Soenneker.Gen.Razor.Sitemaps
### Automatic sitemap generation for Razor apps at build time. Fast, deterministic, and zero-runtime overhead.
## Installation
```
dotnet add package Soenneker.Gen.Razor.Sitemaps
```
## Usage
Enable sitemap generation in the app project:
```xml
true
https://example.com
wwwroot/sitemap.xml
true
```
Routes are discovered from `.razor` files with `@page`. Dynamic routes such as `/products/{id}` are skipped because they cannot be represented as concrete sitemap URLs.
Optional per-page metadata:
```razor
@page "/about"
@using Soenneker.Razor.Sitemap
@attribute [Sitemap(ChangeFrequency = "monthly", Priority = 0.8, LastModified = "2026-04-28")]
```
Use `Exclude = true` to omit a page, or `Url = "/custom-url"` to override the generated route URL. `lastmod` is emitted for every URL from the `.razor` file timestamp unless `LastModified` is set. `ChangeFrequency` and `Priority` are supported but omitted by default. The package injects `Soenneker.Razor.Sitemap.SitemapAttribute` at compile time, so no runtime dependency is required.