🍼 Why you’d add an RSS 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 front matter 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 😅?
Anyway, enough chat, here’s the video. You can drop a comment below or reach out for a chat on Element as well as Twitter @mention if you have suggestions for improvements or questions.
📹 Video #
🗳 Poll #
🖥 Code #
Astro Config #
getStaticPaths
#
Timestamp snippet #
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 .bashrc
, .profile
or .bash_profile
.
Also, on Linux and Unix, swap pbcopy
for xclip
to copy the timestamp to the clipboard.
Use tabs for indentation here for best results.
🔗 Links #
- 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 Apps #
🏁 Astro RSS Feed: Summary #
What is an RSS feed? #
- 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.
How can you use an RSS feed with a blog #
- 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.
What plugins and packages does Astro need to generate an RSS feed? #
- 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.
🙏🏽 Feedback #
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.
Just dropped a new video talking all about how you can add an RSS feed to your new Astro blog.
— Rodney (@askRodney) April 4, 2022
If you're using the 🚀 Astro Blog Markdown starter, this is all already in there, and tested on Astro v0.26 just spin it up!
Hope you find is useful!
https://t.co/GUFXfNKLGn
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 Optimization among other topics. Also, subscribe to the newsletter to keep up-to-date with our latest projects.