fix rss bugs

This commit is contained in:
keyan 2021-08-24 14:44:00 -05:00
parent 56efbcd4fc
commit fd75885c76
1 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ const generateRssItem = (item) => {
<item> <item>
<guid>${SITE_URL}/items/${item.id}</guid> <guid>${SITE_URL}/items/${item.id}</guid>
<title>${escapeXml(item.title)}</title> <title>${escapeXml(item.title)}</title>
<link>${link}</link> <link>${escapeXml(link)}</link>
<comments>${guid}</comments> <comments>${guid}</comments>
<description><![CDATA[<a href="${guid}">Comments</a>]]></description> <description><![CDATA[<a href="${guid}">Comments</a>]]></description>
<pubDate>${new Date(item.createdAt).toUTCString()}</pubDate> <pubDate>${new Date(item.createdAt).toUTCString()}</pubDate>
@ -32,14 +32,14 @@ const generateRssItem = (item) => {
export default function generateRssFeed (items) { export default function generateRssFeed (items) {
const itemsList = items.map(generateRssItem) const itemsList = items.map(generateRssItem)
return ` return `
<rss version="2.0"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>${SITE_TITLE}</title> <title>${SITE_TITLE}</title>
<link>${SITE_URL}</link> <link>${SITE_URL}</link>
<description>${SITE_SUBTITLE}</description> <description>${SITE_SUBTITLE}</description>
<language>en</language> <language>en</language>
<lastBuildDate>${new Date().toUTCString()}</lastBuildDate> <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
<link>${SITE_URL}</link> <atom:link href="${SITE_URL}/rss" rel="self" type="application/rss+xml" />
${itemsList.join('')} ${itemsList.join('')}
</channel> </channel>
</rss> </rss>