studiocms
Version:
Astro Native CMS for AstroDB. Built from the ground up by the Astro community.
51 lines (50 loc) • 1.83 kB
TypeScript
import type { AstroIntegration } from 'astro';
/**
* Options for configuring the dynamic sitemap.
*/
interface DynamicSitemapOptions {
/**
* An array of sitemap configurations.
*/
sitemaps: {
/**
* The name of the plugin that generates the sitemap.
*/
pluginName: string;
/**
* The endpoint path or URL where the sitemap XML can be accessed.
*/
sitemapXMLEndpointPath: string | URL;
}[];
}
/**
* Converts a given string to a safe string format by removing leading and trailing underscores,
* and replacing the prefix 'studiocms_' if present.
*
* @param str - The input string to be converted.
* @returns The converted safe string.
*/
export declare function safeString(str: string): string;
/**
* Generates a dynamic sitemap integration for Astro.
*
* @param {DynamicSitemapOptions} options - Configuration options for the dynamic sitemap.
* @returns {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:
* 1. Creates a resolver using the current module URL.
* 2. Adds virtual imports for the sitemaps.
* 3. Injects a route for the sitemap index.
* 4. 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.
*/
export declare function dynamicSitemap(options: DynamicSitemapOptions): AstroIntegration;
export {};