studiocms
Version:
Astro Native CMS for AstroDB. Built from the ground up by the Astro community.
29 lines (28 loc) • 1.11 kB
TypeScript
import type { APIRoute } from 'astro';
/**
* Generates an XML sitemap index from an array of entries.
*
* @param entries - An array of objects containing the location URLs for the sitemap.
* @returns A string representing the XML sitemap index.
*
* @example
* const entries = [{ location: 'https://example.com/sitemap1.xml' }, { location: 'https://example.com/sitemap2.xml' }];
* const sitemapIndex = template(entries);
* console.log(sitemapIndex);
* // Output:
* // <?xml version="1.0" encoding="UTF-8"?>
* // <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
* // <sitemap><loc>https://example.com/sitemap1.xml</loc></sitemap>
* // <sitemap><loc>https://example.com/sitemap2.xml</loc></sitemap>
* // </sitemapindex>
*/
export declare const template: (entries: {
location: string;
}[]) => string;
/**
* Handles the GET request for generating a dynamic sitemap index.
*
* @param context - The API context containing the request information.
* @returns A Response object containing the generated sitemap index in XML format.
*/
export declare const GET: APIRoute;