ParkSquare.AspNetCore.Sitemap
1.2.63
See the version list below for details.
dotnet add package ParkSquare.AspNetCore.Sitemap --version 1.2.63
NuGet\Install-Package ParkSquare.AspNetCore.Sitemap -Version 1.2.63
<PackageReference Include="ParkSquare.AspNetCore.Sitemap" Version="1.2.63" />
paket add ParkSquare.AspNetCore.Sitemap --version 1.2.63
#r "nuget: ParkSquare.AspNetCore.Sitemap, 1.2.63"
// Install ParkSquare.AspNetCore.Sitemap as a Cake Addin #addin nuget:?package=ParkSquare.AspNetCore.Sitemap&version=1.2.63 // Install ParkSquare.AspNetCore.Sitemap as a Cake Tool #tool nuget:?package=ParkSquare.AspNetCore.Sitemap&version=1.2.63
Asp.Net Core Sitemap.xml & Robots.txt Generator
Background
This package provides automatic generation of sitemap.xml
and robots.txt
for ASP.NET Core application. Both of these files are considered essential for good
Search Engine Optimization (SEO) and are looked upon favourably by search engines such as Google and Bing.
Save the time and hassle of manually maintaining these files, by using the ASP.NET routing tables to generate a standards-compliant sitemap file. Has configurable options to force HTTPs (all sitemap links will use the https protocol), plus Controller or Action exclusions.
Getting Started
Sitemap is implemented as ASP.NET middleware, and works by looking at all controller routes for valid pages that should be included in the xml output.
By default this will only include GET
verbs. If no explicit attribute is defined on your controller method, it will be assumed to be a GET
.
Any requests to /sitemap.xml
or /robots.txt
will be handled by the Sitemap middleware. The robots file will contain a link directing robots (e.g. Googlebot) to your sitemap.
Once you have installed the Nuget package, add this line to Startup.cs to enable Sitemap:
// Place just above app.UseMvc(..)
app.UseSitemap();
Excluding Controller From Sitemap
To exclude a controller and all actions within it, such as an error or login controller, decorate the controller class with the [SitemapExclude]
attribute:
// All routes in this controller will be ignored
[SitemapExclude]
public class BlahController : Controller
{
[Route("some-route")]
public IActionResult Something()
{
return View();
}
}
Excluding Specific Actions/Routes From Sitemap
To exclude only certain actions, routes, or pages from your sitemap, decorate the action method with the [SitemapExclude]
attribute:
public class BlahController : Controller
{
[SitemapExclude]
[Route("some-route")]
public IActionResult Ignored()
{
return View();
}
[Route("some-other-route")]
public IActionResult NotIgnored()
{
return View();
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 is compatible. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
-
.NETCoreApp 2.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Mvc.Core (>= 2.2.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.0.4 | 671 | 6/21/2024 |
6.0.5 | 460 | 12/30/2023 |
6.0.4 | 183 | 12/15/2023 |
6.0.2 | 1,867 | 8/15/2023 |
6.0.1 | 3,857 | 6/9/2023 |
1.2.67 | 180 | 6/8/2023 |
1.2.66 | 1,581 | 9/11/2022 |
1.2.65 | 429 | 8/22/2022 |
1.2.63 | 405 | 8/19/2022 |
1.2.62 | 559 | 11/22/2021 |
1.2.59 | 770 | 5/16/2021 |
1.2.56 | 488 | 4/17/2021 |
1.0.1 | 868 | 4/17/2020 |
1.0.0 | 648 | 4/17/2020 |