Revert contentIndex to RSS 2.0 (#407)

This commit is contained in:
bfahrenfort 2023-08-24 00:57:49 -05:00 committed by GitHub
parent 2e0e518f5d
commit 8200c8d040
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -41,26 +41,26 @@ function generateRSSFeed(cfg: GlobalConfiguration, idx: ContentIndex): string {
const base = cfg.baseUrl ?? "" const base = cfg.baseUrl ?? ""
const root = `https://${base}` const root = `https://${base}`
const createURLEntry = (slug: SimpleSlug, content: ContentDetails): string => `<items> const createURLEntry = (slug: SimpleSlug, content: ContentDetails): string => `<item>
<title>${content.title}</title> <title>${content.title}</title>
<link>${root}/${slug}</link> <link>${root}/${slug}</link>
<guid>${root}/${slug}</guid> <guid>${root}/${slug}</guid>
<description>${content.description}</description> <description>${content.description}</description>
<pubDate>${content.date?.toUTCString()}</pubDate> <pubDate>${content.date?.toUTCString()}</pubDate>
</items>` </item>`
const items = Array.from(idx) const items = Array.from(idx)
.map(([slug, content]) => createURLEntry(simplifySlug(slug), content)) .map(([slug, content]) => createURLEntry(simplifySlug(slug), content))
.join("") .join("")
return `<rss xmlns:atom="http://www.w3.org/2005/atom" version="2.0"> return `<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel> <channel>
<title>${cfg.pageTitle}</title> <title>${cfg.pageTitle}</title>
<link>${root}</link> <link>${root}</link>
<description>Recent content on ${cfg.pageTitle}</description> <description>Recent content on ${cfg.pageTitle}</description>
<generator>Quartz -- quartz.jzhao.xyz</generator> <generator>Quartz -- quartz.jzhao.xyz</generator>
<atom:link href="${root}/index.xml" rel="self" type="application/rss+xml"/>
</channel>
${items} ${items}
</channel>
</rss>` </rss>`
} }