Denomica.Sitemap
1.0.4
dotnet add package Denomica.Sitemap --version 1.0.4
NuGet\Install-Package Denomica.Sitemap -Version 1.0.4
<PackageReference Include="Denomica.Sitemap" Version="1.0.4" />
<PackageVersion Include="Denomica.Sitemap" Version="1.0.4" />
<PackageReference Include="Denomica.Sitemap" />
paket add Denomica.Sitemap --version 1.0.4
#r "nuget: Denomica.Sitemap, 1.0.4"
#:package Denomica.Sitemap@1.0.4
#addin nuget:?package=Denomica.Sitemap&version=1.0.4
#tool nuget:?package=Denomica.Sitemap&version=1.0.4
Denomica.Sitemap
A library that facilitates discovering and enumerating XML sitemaps on a site.
Main Features
The main features that this library provides are described in the following sections.
Discover URLs in Sitemaps
The SitemapCrawler services attempts to discover all sitemaps defined on a site, and then enumerate all URLs defined in those sitemaps. It supports both standard sitemap files and sitemap index files.
If the URL provided is a sitemap XML file, only that sitemap file is processed. If that sitemap XML file contains references to other sitemap files, those are also processed recursively.
Getting Started
In addition to the Denomica.Sitemap package, you will need to install the Microsoft.Extensions.DependencyInjection Nuget package.
The following code sample demonstrates how to use the SitemapCrawler service to crawl a sitemap and retrieve all URLs defined in it.
using Denomica.Sitemap.Services;
using Microsoft.Extensions.DependencyInjection;
var provider = new ServiceCollection()
.AddDenomicaSitemap()
.Services
.BuildServiceProvider();
var crawler = provider.GetRequiredService<SitemapCrawler>();
await foreach(var pageUrl in crawler.CrawlAsync(new Uri("https://yoursite.com")))
{
Console.WriteLine(pageUrl.Location);
}
Version Highlights
v1.0.4
- Added configuration support for supplying a custom HttpClient instance from the consuming application for sitemap crawling.
- Added
IHttpRequestFactoryto centralize HTTP request creation and shared request configuration. - Updated both
SitemapCrawlerandRobotsTxtParserto use the same configured request creation flow. - Applied sample-aligned request defaults for sitemap and robots requests (
HTTP/1.1, browser user-agent, and browser-likeAcceptandConnectionheaders). - Replaced reflection-based request profile behavior with a straightforward reflection-free implementation.
v1.0.3
- Added explicit
301and302redirect following as a fallback for sitemap requests in cases where automatic redirect following does not always work reliably. - Preserved the final resolved target URL after redirect fallback so sitemap discovery continues from the redirected sitemap location.
v1.0.2
- Unified sitemap discovery in
SitemapCrawlersoCanCrawlAsyncandCrawlAsyncuse the same logic to resolve sitemap documents. - Improved default sitemap discovery by probing standard sitemap locations with the same GET-based logic used by the crawler, which fixes sites where
GETsucceeds or redirects butHEADdoes not. - Updated discovery fallback behavior so default sitemap locations are still checked when robots.txt lists sitemap URLs that do not resolve to a valid sitemap.
v1.0.1
- Added
SitemapCrawler.CanCrawlAsyncmethod that checks if a given URL can be crawled by theSitemapCrawlerservice. This method can be used to check if a URL is a sitemap XML file before attempting to crawl it.
v1.0.0
- The first stable version.
- Added support for crawling sitemap XML files from the local file system. The
CrawlAsyncmethod now accepts aUriparameter that can be a local file path or a URL.
v1.0.0-beta.4
- Moved the
UrlSetUrlclass to theDenomica.Sitemap.Modelsnamespace. - Added support for images defined in sitemap files. The
UrlsetUrlclass now includes anImageproperty that contains a list of images defined in the sitemap. TheImageproperty isnullif no images are defined in the sitemap.
v1.0.0-beta.3
- Changed the user agent string that the crawler uses.
v1.0.0-beta.2
- Added support for crawling sitemaps that use an XML namespace other than the default
http://www.sitemaps.org/schemas/sitemap/0.9. Many sites seem to incorrectly use a namespace withhttpsprefix.
v1.0.0-beta.1
- Added overloaded
CrawlAsyncmethod that accepts astringparameter to specify the base URL of the site to crawl.
v1.0.0-alpha.2
- Modified the return type of the
CrawlAsyncmethod to return an async enumerable ofUrlsetUrlobjects.
v1.0.0-alpha.1
- Initial release of the Denomica.Sitemap package.
- Provides a
SitemapCrawlerservice that crawls sitemap XML files and returns all URLs defined in them.
| 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.Extensions.Configuration.Binder (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.