Skip to content

Commit

Permalink
feat(feed): escape html in title and summary
Browse files Browse the repository at this point in the history
  • Loading branch information
ovlb committed Oct 23, 2022
1 parent b2e7ab5 commit 4ea4653
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions _src/feed.11ty.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
const { escape } = require('html-escaper')
const { dateToRfc3339 } = require('@11ty/eleventy-plugin-rss')

function renderFeedItem({ title, url, date, postIntro }) {
return `
<entry>
<title>${title}</title>
<title>${escape(title)}</title>
<id>${url}</id>
<link href="${url}" rel="alternate" />
<published>${dateToRfc3339(new Date(date))}</published>
<updated>${dateToRfc3339(new Date(date))}</updated>
${postIntro ? `<summary>${postIntro}</summary>` : ''}
${postIntro ? `<summary>${escape(postIntro)}</summary>` : ''}
</entry>
`
}
Expand Down

0 comments on commit 4ea4653

Please sign in to comment.