Skip to content

Add an RSS feed

Get ready to…

  • Install an Astro package for creating an RSS feed for your website
  • Create a feed that can be subscribed to and read by RSS feed readers

Astro provides a custom package to quickly add an RSS feed to your website.

This official package generates a non-HTML document with information about all of your blog posts that can be read by feed readers like Feedly, The Old Reader, and more. This document is updated every time your site is rebuilt.

Individuals can subscribe to your feed in a feed reader, and receive a notification when you publish a new blog post on your site, making it a popular blog feature.

  1. Quit the Astro development server and run the following command in the terminal to install Astro’s RSS package.

    Terminal window
    npm install @astrojs/rss
  2. Restart the dev server to begin working on your Astro project again.

    Terminal window
    npm run dev
  1. Create a new file in src/pages/ called rss.xml.js

  2. Copy the following code into this new document. Customize the title and description properties, and if necessary, specify a different language in customData:

    import rss, { pagesGlobToRssItems } from '@astrojs/rss';
    export async function GET(context) {
    return rss({
    title: 'Astro Learner | Blog',
    description: 'My journey learning Astro',
    items: await pagesGlobToRssItems(import.meta.glob('./**/*.md')),
    customData: `<language>en-us</language>`,
  3. Add the site property to the Astro config with your site’s own unique Netlify URL.

    import { defineConfig } from "astro/config";
    export default defineConfig({
    site: ""
  4. Visit http://localhost:4321/rss.xml and verify that you can see (unformatted) text on the page with an item for each of your .md files. Each item should contain blog post information such as title, url, and description.


What’s on your mind?

Create GitHub Issue

Quickest way to alert our team of a problem.