Render markdown for your feed module inside nuxt.config.js
Pre-requisite:
You should have @nuxtjs/markdownit
and @nuxtjs/feed
installed
npm i @nuxtjs/markdownit @nuxtjs/feed
Then, configure your nuxt.config.js as follows
// nuxt markdown setup
const md = require('markdown-it')()
export default {
....
modules: [
'@nuxtjs/markdownit',
'@nuxtjs/feed',
],
markdownit: {
injected: true,
html: true,
},
feed: [
{
path: '/feed.xml',
async create(feed) {
feed.options = {
...
}
const posts = await ...
posts.items.forEach(async (post) => {
const url = `https://yoursite.com/path/${post.slug}`
feed.addItem({
title: post.title,
id: url,
link: url,
description: md.render(post.description),
published: new Date(post.publishDate),
image: `${post.imageURL}`,
content: `
<p>
<img
alt="${post.title}"
src="${post.imageURL}"
>
</p>
${md.render(post.content)}`,
})
})
},
cacheTime: 1000 * 60 * 15,
type: 'rss2',
// data: ['Some additional data']
},
],
....
}