| | |
| | | import { GlobalConfiguration } from "../../cfg" |
| | | import { getDate } from "../../components/Date" |
| | | import { escapeHTML } from "../../util/escape" |
| | | import { FilePath, FullSlug, SimpleSlug, simplifySlug } from "../../util/path" |
| | | import { FilePath, FullSlug, SimpleSlug, joinSegments, simplifySlug } from "../../util/path" |
| | | import { QuartzEmitterPlugin } from "../types" |
| | | import { toHtml } from "hast-util-to-html" |
| | | import path from "path" |
| | |
| | | function generateSiteMap(cfg: GlobalConfiguration, idx: ContentIndex): string { |
| | | const base = cfg.baseUrl ?? "" |
| | | const createURLEntry = (slug: SimpleSlug, content: ContentDetails): string => `<url> |
| | | <loc>https://${base}/${encodeURI(slug)}</loc> |
| | | <loc>https://${joinSegments(base, encodeURI(slug))}</loc> |
| | | <lastmod>${content.date?.toISOString()}</lastmod> |
| | | </url>` |
| | | const urls = Array.from(idx) |
| | |
| | | |
| | | const createURLEntry = (slug: SimpleSlug, content: ContentDetails): string => `<item> |
| | | <title>${escapeHTML(content.title)}</title> |
| | | <link>${root}/${encodeURI(slug)}</link> |
| | | <guid>${root}/${encodeURI(slug)}</guid> |
| | | <link>${joinSegments(root, encodeURI(slug))}</link> |
| | | <guid>${joinSegments(root, encodeURI(slug))}</guid> |
| | | <description>${content.richContent ?? content.description}</description> |
| | | <pubDate>${content.date?.toUTCString()}</pubDate> |
| | | </item>` |