rss link to url if available

This commit is contained in:
keyan 2021-08-19 16:19:35 -05:00
parent 4a770b61b6
commit 2703f1b987
1 changed files with 5 additions and 1 deletions

View File

@ -15,11 +15,15 @@ function escapeXml (unsafe) {
}
const generateRssItem = (item) => {
const guid = `${SITE_URL}/items/${item.id}`
const link = item.url || guid
return `
<item>
<guid>${SITE_URL}/items/${item.id}</guid>
<title>${escapeXml(item.title)}</title>
<link>${SITE_URL}/items/${item.id}</link>
<link>${link}</link>
<comments>${guid}</comments>
<description><![CDATA[<a href="${guid}">Comments</a>]]></description>
<pubDate>${new Date(item.createdAt).toUTCString()}</pubDate>
</item>
`