fix: encodeuri for slugs in rss

This commit is contained in:
Jacky Zhao 2023-09-06 21:31:01 -07:00
parent 989bee5979
commit ef1ead31dc

View file

@ -29,7 +29,7 @@ const defaultOptions: Options = {
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)
@ -44,8 +44,8 @@ function generateRSSFeed(cfg: GlobalConfiguration, idx: ContentIndex): string {
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>`