TinySitemapGenerator 1.0.5
dotnet add package TinySitemapGenerator --version 1.0.5
NuGet\Install-Package TinySitemapGenerator -Version 1.0.5
<PackageReference Include="TinySitemapGenerator" Version="1.0.5" />
paket add TinySitemapGenerator --version 1.0.5
#r "nuget: TinySitemapGenerator, 1.0.5"
// Install TinySitemapGenerator as a Cake Addin #addin nuget:?package=TinySitemapGenerator&version=1.0.5 // Install TinySitemapGenerator as a Cake Tool #tool nuget:?package=TinySitemapGenerator&version=1.0.5
TinySitemapGenerator
Author: Ryan Kueter
Updated: November, 2023
About
TinySitemapGenerator is a free .NET library available from the NuGet Package Manager that provides a simple way to create a sitemap or a sitemap index for your website.
Targets:
- .NET 8
Introduction
The TinySitemapGenerator provides the following options for automatically generating an XML sitemap.
// Create a new sitemap
var sitemap = new Sitemap();
// Optionally add the xsd reference for validation
sitemap.ValidateMap = true;
// Specify the file path
sitemap.Filepath = @"C:\wwwroot";
// Add optional namespaces
sitemap.SitemapOptionalNamespaces.Add(SitemapOptionalNamespace.News);
// Add Sitemap Urls
sitemap.SitemapUrls.Add(
new SitemapUrl {
Location = "https://www.mysite.com/article/tutorial.html",
LastModified = DateTime.Now,
Priority = SitemapPriorities.Nine,
ChangeFrequency = SitemapChangeFrequencies.Never
}
);
// Asychronous Methods
// Generate a standard XML sitemap
await sitemap.SaveSitemapAsync();
// Generate a XML sitemap index because
// you have more than 50,000 urls or your
// files exceed 50MB
await sitemap.SaveSitemapIndexAsync();
// Get the file bytes
var bytes = await sitemap.GetSitemapBytesAsync();
await File.WriteAllBytesAsync(Path.Combine(@"C:\wwwroot", "sitemap.xml"), bytes);
// Generate a XML sitemap index because
// you have more than 50,000 urls or your
// files exceed 50MB
var bytes = await sitemap.GetSitemapIndexBytesAsync();
await File.WriteAllBytesAsync(Path.Combine(@"C:\wwwroot", "sitemap.xml"), bytes);
// Sychronous Methods
// Generate a standard XML sitemap
sitemap.SaveSitemap();
// Generate a XML sitemap index because
// you have more than 50,000 urls or your
// files exceed 50MB
sitemap.SaveSitemapIndex();
// Get the file bytes
var bytes = sitemap.GetSitemapBytes();
File.WriteAllBytes(Path.Combine(@"C:\wwwroot", "sitemap.xml"), bytes);
// Generate a XML sitemap index because
// you have more than 50,000 urls or your
// files exceed 50MB
var bytes = sitemap.GetSitemapIndexBytes();
File.WriteAllBytes(Path.Combine(@"C:\wwwroot", "sitemap.xml"), bytes);
Contributions
This project is being developed for free by me, Ryan Kueter, in my spare time. So, if you would like to contribute, please submit your ideas on the Github project page.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on TinySitemapGenerator:
Package | Downloads |
---|---|
Tazor
Tazor is a NuGet package that seamlessly integrates Blazor Components to provide a dynamic and interactive static site generation solution. This allows you to harness the power of C# and the Blazor framework for building static websites with engaging user interfaces. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Removed depricated methods.