SitemapGenerator class

Generates XML sitemaps and sitemap indexes according to the sitemaps.org protocol.

Validation Contract: In debug mode, constructor assertions enforce that maxUrlsPerSitemap is between 1 and 50,000, and maxBytesPerSitemap is between 1 and protocolMaxBytes (52,428,800 bytes / 50 MB). In both debug and release modes, execution methods (generateUrlset and generateSitemapIndex) perform strict runtime bounds checking and throw ArgumentError on any invalid configuration.

Constructors

SitemapGenerator({int maxUrlsPerSitemap = 50000, int maxBytesPerSitemap = protocolMaxBytes})
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
maxBytesPerSitemap → int
final
maxUrlsPerSitemap → int
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

generateSitemapIndex({required List<SitemapUrlEntry> entries, required String sitemapBaseUrl}) → Map<String, String>
Splits entries into compliant chunks of at most maxUrlsPerSitemap (maximum 50,000 URLs per file per sitemaps.org protocol) and at most maxBytesPerSitemap (52,428,800 bytes uncompressed UTF-8) and generates individual sitemaps plus a master sitemap_index.xml.
generateUrlset(List<SitemapUrlEntry> entries) → String
Generates a single <urlset> XML document string for entries.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

protocolMaxBytes → const int
Maximum allowed uncompressed UTF-8 bytes per sitemap XML document per sitemaps.org protocol (50 MB).
validChangeFrequencies → const Set<String>