/** * A type-safe builder for XML elements in a sitemap. * * ```ts * import { renderSitemap, s } from "jsr:@sondr3/radiant/sitemap"; * * const sitemap = s.document( * s.doctype(), * s.urlset( * s.url( * s.loc("http://www.example.com/"), * s.lastmod(new Date("2005-01-01")), * s.changefreq("monthly"), * s.priority(0.8), * ), * s.url( * s.loc("http://www.example.com/catalog?item=73&desc=vacation_new_zealand"), * s.lastmod(new Date("2004-12-23")), * s.changefreq("weekly"), * ), * s.url( * s.loc("http://www.example.com/catalog?item=74&desc=vacation_newfoundland"), * s.lastmod(new Date("2004-12-23T18:00:15Z")), * s.priority(0.3), * ), * ), * ); * * console.log(renderSitemap(sitemap, { pretty: true })); * ``` * * @module */ import { type XMLAttributes, type XMLDeclarationType, XMLDocument, XMLElement, type XMLStyleSheet } from "./xml.js"; export { renderDocument as renderSitemap } from "./render_xml.js"; type UrlSetAttributes = XMLAttributes & { xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9"; [key: `; type LastModElement = XMLElement<"lastmod", XMLAttributes, string>; type ChangeFreqElement = XMLElement<"changefreq", XMLAttributes, string>; type PriorityElement = XMLElement<"priority", XMLAttributes, string>; type UrlElement = XMLElement<"url", XMLAttributes, LocElement | LastModElement | ChangeFreqElement | PriorityElement>; type UrlSetElement = XMLElement<"urlset", UrlSetAttributes, UrlElement>; type SitemapElement = XMLElement<"sitemap", XMLAttributes, LocElement | LastModElement>; type SitemapIndexElement = XMLElement<"sitemapindex", UrlSetAttributes, SitemapElement>; /** * Represents the possible XML elements that can be included in a sitemap. */ export type SitemapElements = LocElement | LastModElement | ChangeFreqElement | PriorityElement | UrlElement | UrlSetElement | SitemapElement | SitemapIndexElement; declare function urlsetElement(...children: Array): UrlSetElement; declare function urlsetElement(attributes: UrlSetAttributes, ...children: Array): UrlSetElement; type ChangeFreq = "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never"; declare function locElement(loc: string): LocElement; declare function lastModElement(date: Date): LastModElement; declare function changeFreqElement(freq: ChangeFreq): ChangeFreqElement; declare function priorityElement(priority: number): PriorityElement; declare function urlElement(...children: Array): UrlElement; declare function sitemapIndexElement(...children: Array): SitemapIndexElement; declare function sitemapIndexElement(attributes: UrlSetAttributes, ...children: Array): SitemapIndexElement; declare function sitemapElement(...children: Array): SitemapElement; /** * A type-safe builder for XML elements in a sitemap. */ export declare const sitemap: { /** A type-safe builder for the `` element */ document: (doctype: XMLDeclarationType, ...children: Array) => XMLDocument; /** A type-safe builder for the `` element */ doctype: () => XMLDeclarationType; /** A type-safe builder for the `` element */ stylesheet: (href: string, type: string) => XMLStyleSheet; /** A type-safe builder for the `` element */ urlset: typeof urlsetElement; /** A type-safe builder for the `` element */ url: typeof urlElement; /** A type-safe builder for the `` element */ loc: typeof locElement; /** A type-safe builder for the `` element */ lastmod: typeof lastModElement; /** A type-safe builder for the `` element */ changefreq: typeof changeFreqElement; /** A type-safe builder for the `` element */ priority: typeof priorityElement; /** A type-safe builder for the `` element */ sitemapindex: typeof sitemapIndexElement; /** A type-safe builder for the `` element */ sitemap: typeof sitemapElement; }; /** * A type-safe builder for XML elements in a sitemap. */ export declare const s: { /** A type-safe builder for the `` element */ document: (doctype: XMLDeclarationType, ...children: Array) => XMLDocument; /** A type-safe builder for the `` element */ doctype: () => XMLDeclarationType; /** A type-safe builder for the `` element */ stylesheet: (href: string, type: string) => XMLStyleSheet; /** A type-safe builder for the `` element */ urlset: typeof urlsetElement; /** A type-safe builder for the `` element */ url: typeof urlElement; /** A type-safe builder for the `` element */ loc: typeof locElement; /** A type-safe builder for the `` element */ lastmod: typeof lastModElement; /** A type-safe builder for the `` element */ changefreq: typeof changeFreqElement; /** A type-safe builder for the `` element */ priority: typeof priorityElement; /** A type-safe builder for the `` element */ sitemapindex: typeof sitemapIndexElement; /** A type-safe builder for the `` element */ sitemap: typeof sitemapElement; };