SitemapIndex class

Generates a sitemap index file that references multiple sitemaps.

Use this when your site has more than 50,000 URLs or your sitemap exceeds 50MB.

final index = SitemapIndex(
  baseUrl: 'https://myapp.com',
  sitemaps: [
    SitemapReference(path: '/sitemap-pages.xml'),
    SitemapReference(path: '/sitemap-products.xml', lastModified: DateTime.now()),
    SitemapReference(path: '/sitemap-blog.xml'),
  ],
);

final xml = index.generate();

Constructors

SitemapIndex({required String baseUrl, required List<SitemapReference> sitemaps})

Properties

baseUrl String
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sitemaps List<SitemapReference>
final

Methods

generate() String
Generate the sitemap index XML
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