A practical guide to generating XML sitemaps in ASP.NET Core covering all major server-side paradigms: MVC controllers, Razor Pages, and Minimal APIs. Uses the open-source DotnetSitemapGenerator NuGet package combined with custom infrastructure code. Demonstrates how to annotate endpoints with custom attributes to include them in sitemap generation, and also covers database-driven dynamic pages using Entity Framework Core. A working GitHub sample is provided.

6m read timeFrom khalidabuhakmeh.com
Post cover image
Table of contents
What is a Sitemap?A Basic SitemapSetting up the ASP.NET Core InfrastructureASP.NET Core Razor Pages and MVC ActionsASP.NET Core Minimal API endpointsDatabase-driven pages with Entity Framework CoreConclusion