ParkSquare.AspNetCore.Sitemap 1.2.62

.NET Core 2.0
Install-Package ParkSquare.AspNetCore.Sitemap -Version 1.2.62
dotnet add package ParkSquare.AspNetCore.Sitemap --version 1.2.62
<PackageReference Include="ParkSquare.AspNetCore.Sitemap" Version="1.2.62" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ParkSquare.AspNetCore.Sitemap --version 1.2.62
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ParkSquare.AspNetCore.Sitemap, 1.2.62"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ParkSquare.AspNetCore.Sitemap as a Cake Addin
#addin nuget:?package=ParkSquare.AspNetCore.Sitemap&version=1.2.62

// Install ParkSquare.AspNetCore.Sitemap as a Cake Tool
#tool nuget:?package=ParkSquare.AspNetCore.Sitemap&version=1.2.62
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Asp.Net Core Sitemap.xml & Robots.txt Generator

Build Status

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
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

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
1.2.62 214 11/22/2021
1.2.59 494 5/16/2021
1.2.56 278 4/17/2021
1.0.1 577 4/17/2020
1.0.0 385 4/17/2020