Convert raw post content to HTML

- Contains \n shorthand for a paragraph
master
Raymonzut 4 years ago
parent 4b0f683901
commit 9d44aa5d4e
No known key found for this signature in database
GPG Key ID: 1E9BCC39EDD1DD53
  1. 4
      server/routes/api/posts.js

@ -73,7 +73,9 @@ routes.set('/rss.xml', async (req, res) => {
<title>${post.title}</title> <title>${post.title}</title>
<link>https://${req.raw.hostname}/posts?post=${post._id}</link> <link>https://${req.raw.hostname}/posts?post=${post._id}</link>
<guid>https://${req.raw.hostname}/posts?post=${post._id}</guid> <guid>https://${req.raw.hostname}/posts?post=${post._id}</guid>
<description>${post.content}</description> <description><![CDATA[${"\n" + post.content.split("\n").reduce((acc, v) => acc + "<p>" + v + "</p>")}]]></description>
<content type="html">CONTENT HERE: ${post.content}</content>
<pubDate>${post.date}</pubDate>
</item>` </item>`
).join("\n") ).join("\n")
const xml = `<?xml version="1.0" encoding="UTF-8" ?>\n<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> const xml = `<?xml version="1.0" encoding="UTF-8" ?>\n<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">

Loading…
Cancel
Save