Pandorax.Sitemap 1.0.0

dotnet add package Pandorax.Sitemap --version 1.0.0
                    
NuGet\Install-Package Pandorax.Sitemap -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pandorax.Sitemap" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pandorax.Sitemap" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Pandorax.Sitemap" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Pandorax.Sitemap --version 1.0.0
                    
#r "nuget: Pandorax.Sitemap, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Pandorax.Sitemap@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Pandorax.Sitemap&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Pandorax.Sitemap&version=1.0.0
                    
Install as a Cake Tool

Pandorax.Sitemap

A small sitemap library for .NET 10 that writes sitemap.xml files and sitemap indexes with optional extensions (image, video, news, and hreflang).

Features

  • Writes sitemaps and sitemap indexes
  • Supports image, video, news, and hreflang extensions
  • Streaming XML output via XmlWriter

Install

Install from NuGet:

dotnet add package Pandorax.Sitemap

Or with the NuGet Package Manager:

Install-Package Pandorax.Sitemap

Quick Start

using System;
using System.Threading.Tasks;
using Pandorax.Sitemap.Extensions;
using Pandorax.Sitemap.Models;

public static class Example
{
    public static async Task<string> BuildSitemapAsync()
    {
        var sitemap = new Sitemap(new[]
        {
            new SitemapUrl(
                loc: new Uri("https://example.com/"),
                lastModified: new DateTimeOffset(2026, 1, 29, 12, 30, 0, TimeSpan.Zero),
                changeFrequency: ChangeFrequency.Daily,
                priority: 1.0m,
                images: new[]
                {
                    new ImageEntry(new Uri("https://example.com/images/hero.jpg"))
                    {
                        Title = "Homepage Hero",
                        Caption = "Our main banner"
                    }
                },
                videos: new[]
                {
                    new VideoEntry(
                        thumbnailLoc: new Uri("https://example.com/videos/intro-thumb.jpg"),
                        title: "Intro",
                        description: "Quick product introduction")
                    {
                        ContentLoc = new Uri("https://example.com/videos/intro.mp4"),
                        Duration = TimeSpan.FromSeconds(90)
                    }
                },
                news: new[]
                {
                    new NewsEntry(
                        publicationName: "Example News",
                        publicationLanguage: "en",
                        publicationDate: new DateTimeOffset(2026, 1, 25, 8, 0, 0, TimeSpan.Zero),
                        title: "We launched a new feature")
                    {
                        Keywords = "feature,launch"
                    }
                },
                alternates: new[]
                {
                    new AlternateLink("en", new Uri("https://example.com/")),
                    new AlternateLink("fr", new Uri("https://example.com/fr/"))
                })
        });

        return await sitemap.ToXmlAsync();
    }
}

Writing to a Stream

using System.IO;
using System.Threading.Tasks;
using Pandorax.Sitemap.Models;
using Pandorax.Sitemap.Writers;

public static class StreamExample
{
    public static async Task WriteToStreamAsync(Sitemap sitemap, Stream output)
    {
        var writer = new SitemapWriter();
        await writer.WriteAsync(sitemap, output);
    }
}

Minimal ASP.NET MVC Controller Example

using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Pandorax.Sitemap.Extensions;
using Pandorax.Sitemap.Models;

[ApiController]
[Route("sitemap.xml")]
public sealed class SitemapController : ControllerBase
{
    [HttpGet]
    public async Task<IActionResult> Get()
    {
        var sitemap = new Sitemap(new[]
        {
            new SitemapUrl(
                loc: new Uri("https://example.com/"),
                lastModified: new DateTimeOffset(2026, 1, 29, 12, 30, 0, TimeSpan.Zero))
        });

        var xml = await sitemap.ToXmlAsync();
        return Content(xml, "application/xml");
    }
}

Validation

  • URLs must be absolute (Uri.IsAbsoluteUri)
  • A sitemap can contain up to 50,000 URLs
  • A sitemap index can contain up to 50,000 entries
  • Required extension fields are enforced (e.g., image:loc, video:thumbnail_loc)

License

MIT.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

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.0.0 336 2/2/2026
0.0.0-alpha002 118 2/2/2026