lib/dynamic-sitemap
Functions
'Read the “', Functions, '” section'dynamicSitemap()
'Read the “', dynamicSitemap(), '” section'function dynamicSitemap(options: DynamicSitemapOptions): AstroIntegration
Defined in: studiocms/packages/studiocms/src/lib/dynamic-sitemap/index.ts:56
Generates a dynamic sitemap integration for Astro.
Parameters
'Read the “', Parameters, '” section'DynamicSitemapOptions
Configuration options for the dynamic sitemap.
AstroIntegration
The Astro integration object.
The integration adds virtual imports for sitemaps and injects routes for the sitemap index and individual sitemaps.
The options
parameter should include:
sitemaps
: An array of objects, each containing:pluginName
: The name of the plugin.sitemapXMLEndpointPath
: The entry point path for the sitemap XML.
The function performs the following steps:
- Creates a resolver using the current module URL.
- Adds virtual imports for the sitemaps.
- Injects a route for the sitemap index.
- Iterates over the provided sitemaps and injects routes for each sitemap.
If multiple sitemaps have the same pattern, a unique pattern is generated by appending an index.