Source: paulund.co.uk

Add RSS Feed To Nuxt3 App
In this tutorial we're going to create an RSS feed to use with Nuxt3 and https://content.nuxtjs.org/ module. First we're going to install the https://www.npmjs.com/package/rss package into our application. In Nuxt3 there is a feature to create https://v3.nuxtjs.org/guide/features/server-routes/ we're going to use this to create our RSS feed route.

In this file we need to fetch the latest articles and output them in RSS feed format. import { serverQueryContent } from '#content/server'import RSS from 'rss'export default defineEventHandler(async (event) => { const docs = await serverQueryContent(event).sort({ createdAt: -1 }).limit(100).find() const blogPosts = docs.filter((doc) => doc?._path?.includes('/articles')) const feed = new RSS({ title: 'Paulund', site_url: 'https://paulund.co.uk', feed_url: `https://paulund.co.uk/feed/rss.xml`, }) for (const doc of blogPosts) { feed.item({ title: doc.title ??
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners