| | |
| | | import { GlobalConfiguration } from "../../cfg" |
| | | import { getDate } from "../../components/Date" |
| | | import { FilePath, FullSlug, SimpleSlug, simplifySlug } from "../../util/path" |
| | | import { QuartzEmitterPlugin } from "../types" |
| | | 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}/${slug}</loc> |
| | | <loc>https://${base}/${encodeURIComponent(slug)}</loc> |
| | | <lastmod>${content.date?.toISOString()}</lastmod> |
| | | </url>` |
| | | const urls = Array.from(idx) |
| | |
| | | |
| | | const createURLEntry = (slug: SimpleSlug, content: ContentDetails): string => `<item> |
| | | <title>${content.title}</title> |
| | | <link>${root}/${slug}</link> |
| | | <guid>${root}/${slug}</guid> |
| | | <link>${root}/${encodeURIComponent(slug)}</link> |
| | | <guid>${root}/${encodeURIComponent(slug)}</guid> |
| | | <description>${content.description}</description> |
| | | <pubDate>${content.date?.toUTCString()}</pubDate> |
| | | </item>` |
| | |
| | | const linkIndex: ContentIndex = new Map() |
| | | for (const [_tree, file] of content) { |
| | | const slug = file.data.slug! |
| | | const date = file.data.dates?.modified ?? new Date() |
| | | const date = getDate(ctx.cfg.configuration, file.data) ?? new Date() |
| | | if (opts?.includeEmptyFiles || (file.data.text && file.data.text !== "")) { |
| | | linkIndex.set(slug, { |
| | | title: file.data.frontmatter?.title!, |