The Trans Directory
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: use joinSegment instead of joining via slash in sitemap (closes #658)

+4 -4
+4 -4
quartz/plugins/emitters/contentIndex.ts
··· 2 2 import { GlobalConfiguration } from "../../cfg" 3 3 import { getDate } from "../../components/Date" 4 4 import { escapeHTML } from "../../util/escape" 5 - import { FilePath, FullSlug, SimpleSlug, simplifySlug } from "../../util/path" 5 + import { FilePath, FullSlug, SimpleSlug, joinSegments, simplifySlug } from "../../util/path" 6 6 import { QuartzEmitterPlugin } from "../types" 7 7 import { toHtml } from "hast-util-to-html" 8 8 import path from "path" ··· 37 37 function generateSiteMap(cfg: GlobalConfiguration, idx: ContentIndex): string { 38 38 const base = cfg.baseUrl ?? "" 39 39 const createURLEntry = (slug: SimpleSlug, content: ContentDetails): string => `<url> 40 - <loc>https://${base}/${encodeURI(slug)}</loc> 40 + <loc>https://${joinSegments(base, encodeURI(slug))}</loc> 41 41 <lastmod>${content.date?.toISOString()}</lastmod> 42 42 </url>` 43 43 const urls = Array.from(idx) ··· 52 52 53 53 const createURLEntry = (slug: SimpleSlug, content: ContentDetails): string => `<item> 54 54 <title>${escapeHTML(content.title)}</title> 55 - <link>${root}/${encodeURI(slug)}</link> 56 - <guid>${root}/${encodeURI(slug)}</guid> 55 + <link>${joinSegments(root, encodeURI(slug))}</link> 56 + <guid>${joinSegments(root, encodeURI(slug))}</guid> 57 57 <description>${content.richContent ?? content.description}</description> 58 58 <pubDate>${content.date?.toUTCString()}</pubDate> 59 59 </item>`