Astro RSS Feed: add a Blog Feed to your Astro Site Astro RSS Feed: add a Blog Feed to your Astro Site
In this video you will see you can add an Astro RSS feed to your site without any external packages : the feature comes for free with Astro. What is an RSS feed though? You can use a podcast app to find and subscribe to podcasts. Similarly, there are RSS apps which let you subscribe to written content and have new content appear in your feed as well as let you read written content. That is all powered by RSS feeds. On top you can use RSS feeds in automation . For example, add a self-updating list of your latest blog posts to your GitHub feed. In fact we will see how you can go about doing just that in this video.
As well as introducing RSS feeds, the video shows you how you can link Markdown frontmatter
in your blog posts into your RSS feed. Essentially you can set up your
RSS feed in Astro and then forget about it. New content is automatically added
so long as your posts contain the right meta. With Astro, by default, the generated RSS feed
is available at
https:/example.com/rss.xml. Astro even styles the
RSS feed for you… what more could you ask for 😅?
Add this snippet to your shell profile file. This has been tested on MacOS using zsh. If you use
other shells or operating systems, you might need to drop it into to
Also, on Linux and Unix, swap
xclip to copy the timestamp to the clipboard.
Use tabs for indentation here for best results.
- Getting started with the Astro Blog Markdown Starter ,
- Example RSS Feed: Rodney Lab Site ,
- Astro Blog Markdown GitHub repo ,
- Stefan Natter post on linking your GitHub profile to your RSS Feed ,
- Astro docs on getStaticPath API ,
- Vite Glob imports ,
- Twitter handle: @askRodney .
- RSS feeds are just lists of website content which you can publish on your website. Just like you have podcast apps to discover and subscribe to podcasts, there are also RSS apps for finding written content. To let folks subscribe to your content feed, you just have to make sure your RSS feed is in the right format. Typically you publish an rss.xml file on your site which contains information on the language of the content and a description as well as links to the actual articles. Ideally you want to set and forget RSS for your blog so your site builder refreshes rss.xml each time you make new content available.
- Adding an RSS feed to your blog makes it easy for your followers to subscribe to your content. As well as this, you can use the RSS feed in automation. For example, if you are technically minded you might consider wiring up services like IFTTT and Zapier. If you are a developer and have a GitHub page you can also have GitHub actions automatically generate an up-to-date list of your latest posts right in your profile.
- Astro is a kind of batteries included tool. As such you do not need to add a single plugin or package to generate an RSS feed on every build. We have seen you just need to add a couple of lines to your config. You also need to let Astro know how to map meta on your posts to the expected RSS fields. You leave the rest to Astro, it generates your feed in the format expected by RSS apps as well as automation platforms.
If you have found this video useful, see links below for further related content on this site. I do hope you learned one new thing from the video. Let me know if there are any ways I can improve on it. I hope you will use the code or starter in your own projects. Be sure to share your work on Twitter, giving me a mention so I can see what you did. Finally be sure to let me know ideas for other short videos you would like to see. Read on to find ways to get in touch, further below. If you have found this post useful, even though you can only afford even a tiny contribution, please consider supporting me through Buy me a Coffee .
Finally, feel free to share the post on your social media accounts for all your followers who will find it useful. As well as leaving a comment below, you can get in touch via @askRodney on Twitter and also askRodney on Telegram . Also, see further ways to get in touch with Rodney Lab . I post regularly on SvelteKit as well as Search Engine Optimisation among other topics. Also subscribe to the newsletter to keep up-to-date with our latest projects.