Skip to content

Instantly share code, notes, and snippets.

Created April 13, 2021 02:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Generate an RSS feed for a Next-MDX blog
const fs = require('fs')
const RSS = require('rss')
const { getAllNodes } = require('next-mdx');
const feed = new RSS({
title: 'My Blog',
site_url: ''
const posts = await getAllNodes('post');
posts.forEach(post => {
title: post.frontMatter.title,
guid: post.slug,
url: `${post.url}`,
const xml = feed.xml({ indent: true });
fx.writeFileSync('public/rss.xml', xml);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment