An RSS feed gives readers a simple way to follow a website without checking its homepage every day. It also provides a predictable source of new-article metadata for feed readers, monitoring tools, and automation workflows.
For an Astro website that publishes Markdown articles through Decap CMS, an RSS feed can be generated automatically whenever the site is built. You do not need to run a separate feed server, add client-side JavaScript, or maintain a second list of published articles.
But there are details worth getting right. A feed that includes unpublished drafts, points to incorrect slugs, or contains invalid dates is worse than no feed at all.
In this guide, we’ll build a practical RSS 2.0 feed using @astrojs/rss and Astro Content Collections, connect it to a Decap CMS publishing workflow, and test the generated XML before deploying to Cloudflare Pages.
What you’ll learn:
- Generate
/rss.xmlfrom your existing Astro blog collection. - Exclude drafts, invalid dates, and future-dated posts.
- Keep feed links consistent with real article URLs.
- Add RSS discovery metadata and a visible subscribe link.
- Validate XML and check the feed after deployment.
- Optionally consume the same feed in n8n for content monitoring.
The code examples are a reference implementation, not a claim that they have already been deployed on DuongHoangNam.com. Adjust collection names and frontmatter fields to match your project before using them.
1. What Is an RSS Feed, and When Is It Useful?
RSS (Really Simple Syndication) is an XML-based format for publishing updates. A typical blog feed contains a channel describing the website and a series of items describing individual articles.
Each article item can expose a title, publication date, description, and permanent URL. An RSS reader periodically fetches the XML document and notices items it has not seen before.
For a technical blog, RSS supports several practical workflows:
- Reader subscriptions: Developers can follow new tutorials in Feedly or another feed reader.
- Content monitoring: An automation can detect newly published posts and notify a team.
- Syndication: Other services can reference your original article URLs rather than scrape your entire website.
- Editorial quality checks: The feed provides another place to catch incorrect titles, slugs, or dates.
RSS is not an email newsletter. It does not automatically collect subscribers’ email addresses, send messages, or reveal exactly who reads an article. A reader needs to subscribe using an RSS-compatible tool.
It is also not a guaranteed search-ranking boost. Google may use site-referenced feeds to discover URLs, but an RSS feed does not replace your sitemap, canonical URLs, useful content, or normal crawlability.
2. How RSS Fits into Astro, Decap CMS, and Cloudflare Pages
The publishing architecture is straightforward:
Editor creates or updates a Markdown post in Decap CMS
|
v
Git changes are published to the main branch
|
v
Cloudflare Pages starts the Astro build
|
v
Content Collections load published article metadata
|
v
@astrojs/rss generates dist/rss.xml
|
v
Cloudflare Pages serves https://your-site.example/rss.xml
|
v
RSS reader retrieves the feed and notices new articles
This is build-time generation, which is a good match for a static blog. The feed updates when a successful build produces new output. Saving a draft in Decap CMS does not, by itself, imply that a new production feed was generated.
Your editorial workflow still determines which content reaches the published branch. The RSS endpoint should add another safety check for drafts and future-dated articles rather than assuming that every entry in the collection is public.

Figure 1: A build-time RSS workflow uses the same content source as the published Astro website.
3. Prerequisites and a Pre-Installation Audit
This tutorial assumes you have an Astro website with a blog content collection and Markdown posts managed by Decap CMS. You should also have permission to edit the repository and run a local build.
Before installing anything, verify these details:
- Does an RSS feed already exist at
/rss.xml,/feed.xml, or another endpoint? Search the repository and inspect the deployed website. - Does
astro.config.mjsdefine the productionsiteURL? - Which frontmatter field stores publication dates:
date,pubDate, or another name? - Does your blog route use a file-derived
id, an explicitslug, or a custom URL resolver? - How does the website exclude drafts and scheduled posts from publicly accessible article pages?
- Does your current Cloudflare Pages build copy static output from
dist/?
Do not create a second feed under an existing filename. If a feed is already in use, review and improve that implementation instead of silently replacing it.
For this tutorial, we will use /rss.xml and article URLs shaped like /blog/article-slug/.
4. Install the Official Astro RSS Package
From the project root, install the package:
npm install @astrojs/rss
Then build your project to confirm the dependency itself does not introduce an error:
npm run build
The official package exposes an rss() helper that generates RSS XML from a list of items. The endpoint can be prerendered for a static deployment.
If you are using Windows PowerShell and your environment requires it, the equivalent commands may be npm.cmd install @astrojs/rss and npm.cmd run build.
Do not update unrelated dependencies or replace your lockfile merely to add RSS support.
5. Configure the Canonical Website Origin
Astro uses the site setting to construct absolute URLs in generated resources.
Review astro.config.mjs and make sure the existing configuration includes the correct production origin:
import { defineConfig } from 'astro/config';
export default defineConfig({
site: 'https://duonghoangnam.com',
// Preserve your existing integrations, adapter, and other settings.
});
This snippet is illustrative. Do not overwrite an existing Astro configuration file. Add or verify only the relevant property.
Choose one canonical host, such as the apex domain, and keep it consistent across article links, the sitemap, canonical tags, and RSS metadata.
If you redirect www to the apex domain, verify that the redirect works separately. A feed can contain correct-looking URLs while the destination host still fails to load.
6. Understand the Decap CMS Frontmatter Fields
RSS output depends on the metadata that Astro reads from your Markdown files. A simplified article may have frontmatter like this:
---
title: "Build a Reliable Astro Blog"
description: "A practical guide to Astro publishing workflows."
date: 2026-11-05
slug: "build-a-reliable-astro-blog"
category: "Tutorials"
draft: false
---
This is an example schema, not the confirmed schema of any particular installation.
The most important RSS fields are:
| Field | Why it matters | Common mistake |
|---|---|---|
title |
Identifies the article | Empty or misleading title |
description |
Summarizes the article | Copied HTML or an empty field |
date / pubDate |
Supplies RSS publication time | Invalid or inconsistent date format |
slug / id |
Generates the article URL | Feed URL differs from the actual route |
draft / status |
Controls visibility | Private draft appears in public feed |
Decap CMS validates its own form fields, but that does not automatically guarantee the generated public RSS is correct. The final source of truth is the content loaded by your build and the URLs actually rendered.
If your Content Collections schema already validates these fields with Zod, keep using that schema. Do not replace it with a generic rssSchema without understanding its effects on your existing content.
7. Filter Drafts, Scheduled Posts, and Invalid Metadata
getCollection('blog') retrieves collection entries. It does not promise that those entries are all ready for public syndication.
A safe feed should use rules consistent with your public blog routes:
- Exclude entries where the established draft flag is true.
- Exclude entries in a draft editorial status.
- Exclude posts whose publication dates are missing or invalid.
- Exclude dates later than the current build time.
- Require a usable title and article path.
- Sort by publication date, newest first.
Sorting is essential because Content Collections do not promise a useful default order for your feed.
There is another subtle failure mode: if a scheduled article is built before its release date, a static feed will not automatically refresh at midnight. The site must be rebuilt at or after publication time for that item to appear. Use a scheduled deployment or an editorial publish event if scheduled releases matter.

Figure 2: Validate publication metadata before emitting public RSS items, and use the same URL logic as the article pages.
8. Create the RSS Endpoint in Astro
Create the file:
src/pages/rss.xml.ts
The following example accepts either date or pubDate and falls back to the content entry’s id if there is no explicit slug.
It assumes the public articles use /blog/{slug}/. If your website generates URLs differently, change the link field before deploying.
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
import type { APIRoute } from 'astro';
// For hybrid/on-demand sites, explicitly prerender this RSS endpoint.
export const prerender = true;
type FeedFields = {
title?: unknown;
description?: unknown;
summary?: unknown;
pubDate?: unknown;
date?: unknown;
slug?: unknown;
draft?: unknown;
status?: unknown;
};
type FeedRecord = {
title: string;
description: string;
slug: string;
publishedAt: Date | null;
excluded: boolean;
};
function parseDate(value: unknown): Date | null {
if (!(value instanceof Date) &&
typeof value !== 'string' && typeof value !== 'number') {
return null;
}
const date = value instanceof Date ? value : new Date(value);
return Number.isNaN(date.getTime()) ? null : date;
}
function asText(value: unknown): string {
return typeof value === 'string' ? value.trim() : '';
}
export const GET: APIRoute = async ({ site }) => {
if (!site) {
throw new Error('Configure `site` in astro.config.mjs before generating RSS.');
}
const now = Date.now();
const posts = await getCollection('blog');
const records: FeedRecord[] = posts.map((post) => {
const data = post.data as unknown as FeedFields;
const rawSlug = asText(data.slug) || post.id;
return {
title: asText(data.title),
description:
asText(data.description) ||
asText(data.summary) ||
'Read the complete article on DuongHoangNam.com.',
// This assumes article pages use /blog/<slug>/ URLs.
slug: rawSlug.replace(/^\/+|\/+$/g, ''),
publishedAt: parseDate(data.pubDate ?? data.date),
excluded: data.draft === true || asText(data.status) === 'draft',
};
});
const visible = records
.filter((post) =>
!post.excluded &&
Boolean(post.title) &&
Boolean(post.slug) &&
post.publishedAt !== null &&
post.publishedAt.getTime() <= now
)
.sort((a, b) =>
b.publishedAt!.getTime() - a.publishedAt!.getTime()
)
.slice(0, 30);
return rss({
title: 'DuongHoangNam.com — AI, Automation & Technology',
description: 'Practical tutorials on AI, Astro, automation, and software engineering.',
site,
items: visible.map((post) => ({
title: post.title,
description: post.description,
link: `/blog/${post.slug}/`,
pubDate: post.publishedAt!,
})),
customData: '<language>en-us</language>',
});
};
Why this implementation makes these choices
prerender = true makes the RSS endpoint a generated static asset, including in projects that otherwise support server rendering.
getCollection('blog') uses Astro’s content API. The field mapping is intentionally explicit because an existing Decap CMS project might use different frontmatter conventions.
parseDate() rejects unusable dates instead of producing invalid pubDate values. The filter also excludes dates later than the build time.
The feed returns the newest 30 records. This is an editorial choice, not a standard requirement. You can publish more or fewer items depending on your content volume.
Most importantly, this implementation does not expose the full article body. A short description plus a link avoids dealing with embedded scripts, relative images, complex Markdown, and HTML sanitization during the initial rollout.
A note about publication status
The reference code only recognizes draft: true and status: draft. It does not know every custom CMS workflow status. If your site has additional private or scheduled states, update this check so the feed cannot expose content that the public article listing hides.
9. Prevent Incorrect Slugs and Duplicate URLs
One of the most damaging RSS mistakes is producing a link that looks plausible but returns HTTP 404.
Consider a Markdown file named:
src/content/blog/intro-to-rss.md
Its content entry ID might be intro-to-rss, but your CMS may have generated a public URL from an explicit frontmatter slug or another route rule.
If the actual published page is:
/blog/rss-feed-for-developers/
then a feed item linking to /blog/intro-to-rss/ is wrong, even though the XML is technically valid.
Use the same URL helper for both article pages and RSS. For a larger project, extract a shared function such as getBlogPostUrl(post) and import it into both the blog route and rss.xml.ts.
This also matters when you rename a slug. An RSS reader often uses the item’s link or GUID to recognize an existing article. Changing the public URL unnecessarily may make an old post appear as a new item or leave subscribers with a dead link. Redirect old URLs when appropriate and avoid changing identifiers casually.
Before launching RSS, compare a representative sample of feed links with real published pages, not with the filenames alone.
10. Add RSS Autodiscovery to Your Astro Layout
Once the endpoint exists, help feed readers discover it.
Add this element inside the <head> of the layout or SEO component used by the blog:
<link
rel="alternate"
type="application/rss+xml"
title="DuongHoangNam.com RSS Feed"
href={new URL('/rss.xml', Astro.site).toString()}
/>
This assumes Astro.site is configured. If your current layout already renders an RSS autodiscovery element, update that existing element instead of creating a duplicate.
RSS autodiscovery is not a subscription pop-up. It is metadata that compatible software can use to find the feed URL.
Keep this link independent from Google Analytics, cookie consent, and other optional client-side scripts. RSS works without visitor tracking.
11. Add a Visible Subscribe Link
Autodiscovery helps software, but readers need a visible way to find the feed.
A simple link in your blog header or footer is enough:
<a
href="/rss.xml"
type="application/rss+xml"
aria-label="Subscribe to new blog posts with RSS"
>
Subscribe via RSS
</a>
Use straightforward language. Visitors unfamiliar with RSS may appreciate a short explanation such as “Copy this feed URL into your preferred RSS reader.”
Avoid presenting it as an email newsletter unless you actually operate a separate email subscription service.
You can also place the link next to your blog search function, but do not hide it inside an inaccessible menu or make it dependent on JavaScript.
12. Summary Feed or Full-Content Feed?
Astro’s RSS package can include full HTML content, but that choice comes with additional responsibilities.
| Approach | Benefits | Tradeoffs |
|---|---|---|
| Title + description + link | Simple, fast, fewer compatibility issues | Readers open the original page for the full guide |
| Full HTML content | Convenient reading inside feed applications | Must sanitize HTML and fix relative links/images |
For a technical blog with code blocks, optimized WebP images, and interactive elements, I recommend starting with the summary format.
Full-text feeds can be a good option later, but do not pass arbitrary user-generated Markdown directly into XML as untrusted HTML. Render it deliberately, sanitize the result, and convert relative links and image paths to absolute URLs.
This also matters for newsletters and AI integrations: make your publication format reliable before building automation that republishes it elsewhere.
13. Build and Validate the Generated RSS XML
After adding the endpoint, run a production build:
npm run build
For the default static output directory, verify that this file exists:
dist/rss.xml
Open it in a text editor. A minimal RSS output should resemble:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Example Technology Blog</title>
<description>Recent practical tutorials.</description>
<link>https://example.com/</link>
<item>
<title>Example Article</title>
<link>https://example.com/blog/example-article/</link>
<pubDate>Thu, 05 Nov 2026 00:00:00 GMT</pubDate>
<description>A useful introduction.</description>
</item>
</channel>
</rss>
The example is illustrative; the generated XML may include additional elements and namespaces.
Run three types of checks:
- XML structure: Is the document well-formed RSS 2.0 with a channel and valid items?
- Content correctness: Are titles, dates, descriptions, and links plausible? Are drafts absent?
- Live URL correctness: After deployment, do the linked articles return the expected public pages?
The downloadable package includes a small Python standard-library validator:
python scripts/check_rss.py dist/rss.xml
It checks XML structure, presence of article metadata, duplicate links, and the expected domain. It is not a replacement for testing live HTTP responses or subscribing in a real feed reader.

Figure 3: A useful RSS launch requires successful generation, correct XML metadata, and a working subscription path.
14. Deploy the Feed to Cloudflare Pages
Deploy your change through the project’s normal Git and Cloudflare Pages workflow. The basic sequence is:
Create feature branch
-> Add @astrojs/rss and RSS endpoint
-> Run local build and validate XML
-> Review CMS field mapping and real URLs
-> Open pull request and inspect Preview deployment
-> Merge only after successful checks
-> Verify production /rss.xml
Cloudflare Pages can serve a prerendered XML file as a static asset; it does not need to execute an email service or Pages Function for each subscriber request.
After deployment, test:
https://duonghoangnam.com/rss.xml
This is the target URL for the tutorial, not a statement that the endpoint is already live on the website.
Check the response status, content type, XML contents, and whether the file includes the latest published article. Then test the actual URLs from at least several feed items.
If a preview succeeds but production does not, inspect your Pages deployment status, output directory, branch configuration, and whether another route or function takes precedence.
15. Connect the RSS Feed to an n8n Workflow
Once the feed is public and valid, it can serve as an input for automation.
An example monitoring workflow looks like this:
Schedule Trigger
|
v
RSS Read (https://your-site.example/rss.xml)
|
v
Normalize item title, link, and publication date
|
v
Check existing item IDs or URLs
|
+--- Already processed --> Stop
|
v
Store new record in Google Sheets
|
v
Notify an editor or update a content dashboard
Use the article’s stable public URL as a deduplication key, or adopt a persistent GUID strategy if your feed supplies one.
The RSS feed is an input signal, not proof that every generated summary or downstream AI action is correct. If you use AI to categorize or summarize posts, preserve the source URL and keep consequential publishing decisions under appropriate review.
For an example of this pattern, see our existing n8n content research workflow with RSS and Google Sheets.
16. Troubleshooting Common Astro RSS Problems
/rss.xml returns 404
Confirm that the endpoint lives under src/pages/, that the build completed successfully, and that the expected XML file exists in the output directory. On Cloudflare Pages, verify that the correct branch and build artifact were deployed.
Feed contains drafts
Check your collection query and actual frontmatter values. Decap CMS editorial states do not necessarily map to a draft field. Align RSS visibility rules with your public article renderer.
Items appear in the wrong order
Explicitly sort by publication date. Content Collections are not guaranteed to return entries in chronological order.
Article links are broken
Do not derive slugs from filenames unless your router does the same. Use a shared URL helper, then test generated article links.
A newly scheduled article is missing
If the build occurred before the scheduled date, the article will remain excluded until a later build. Static RSS feeds do not update based on time alone.
Feed contains invalid dates
Inspect CMS field types and Zod coercion. Prefer validated date values, rather than constructing invalid JavaScript Date objects and passing them to RSS.
Images do not display inside feed readers
If you choose full HTML content, check relative image URLs and reader support. A summary-only feed avoids most embedded-image compatibility issues.
RSS reader shows an old version
First confirm production actually serves the latest XML. Then check the reader’s refresh interval and any CDN or application caching behavior. Feed readers do not necessarily fetch updates immediately.
17. RSS, Discoverability, SEO, and Privacy
An RSS feed supports discoverability and reader choice, but it should be evaluated realistically.
Potential benefits: visitors can subscribe with independent tools, automation workflows have structured article metadata, and crawlers may discover recently published URLs.
What it does not guarantee: better Google rankings, indexing of every item, more search impressions, or a measurable increase in traffic.
Your sitemap and canonical tags remain important. Continue to use descriptive article titles, reliable redirects when slugs change, and links that point to real published resources.
RSS does not require analytics cookies or tracking scripts. It is typically a public document that anyone can request. Avoid exposing unpublished content, private notes, internal-only metadata, or tokens in item descriptions.
If you later use an RSS-to-email or RSS-to-social automation, review privacy, rate limits, copyright, and the sending provider’s requirements separately.
18. Production Readiness Checklist
Before announcing the new feed:
- The endpoint filename is not already used by another feed.
- The Astro
sitesetting matches the intended canonical host. - The feed uses the same visibility rules as public article pages.
- Drafts, future posts, and invalid dates are excluded.
- Feed item URLs match real blog routes and redirect policies.
- RSS items have useful titles and descriptions.
- The build generates
dist/rss.xmlsuccessfully. - The XML validator reports no structural or duplicate-link errors.
- Live article links have been spot-checked after deployment.
- The blog layout provides RSS autodiscovery.
- Readers can find an accessible subscribe link.
- The feed works in at least one real RSS reader.
- Scheduled articles have an intentional rebuild policy.
- A future change to CMS fields will not silently break RSS output.
19. Frequently Asked Questions
Does Astro have built-in support for RSS?
Astro provides the official @astrojs/rss package to generate RSS feeds from content collections or other supported sources. You install the package and define an endpoint, such as src/pages/rss.xml.ts.
Can RSS work on a free Cloudflare Pages website?
Yes. A prerendered RSS feed is simply a static XML asset. It does not require a separate mail server or a continuously running application process.
Will RSS automatically update when I save a Decap CMS draft?
Not necessarily. A static feed updates after a successful build, and your publication rules determine which content is eligible. Saving a draft should not publish it into the public feed.
Does RSS improve Google rankings?
There is no guaranteed ranking increase. A feed can help discovery, but it does not replace quality content, crawlable pages, canonical metadata, or a sitemap.
Should my RSS feed include the complete article?
For a code-heavy tutorial site, starting with titles, descriptions, dates, and links is simpler. Full-text feeds require more work to sanitize HTML and handle embedded assets correctly.
Is RSS the same as an email newsletter?
No. RSS readers pull a public XML feed. An email newsletter involves subscribers, consent, delivery services, and separate operational requirements.
Can I use the feed with n8n?
Yes. An n8n workflow can read RSS items, deduplicate by stable URLs or GUIDs, and process newly published articles according to your workflow rules.
20. Final Thoughts
An RSS feed is a relatively small improvement that can make a growing Astro blog easier to follow and integrate with other tools.
The implementation does not need to be complicated: install @astrojs/rss, read your content collection, filter to genuinely published items, generate /rss.xml, and expose the feed in your website’s layout.
The difficult part is ensuring the feed reflects reality. A valid XML document is not enough if it exposes drafts, contains incorrect dates, or links to pages that do not exist.
Start with a summary feed, reuse your site’s publication and URL rules, verify the output after each important CMS change, and add more advanced syndication features only when you need them.
Continue Reading
- How to Build an Astro Blog with Decap CMS and Cloudflare Pages — Set up the publishing architecture that supplies articles to the feed.
- n8n Automation Tutorial: Build an AI Content Research Workflow with RSS and Google Sheets — Consume RSS updates in an automation workflow.
- Astro SEO Guide 2026: 12 Essential Steps to Optimize Your Website for Google — Combine RSS with sitemaps, canonical URLs, and better content discovery.
Official References
- Astro Docs — Add an RSS Feed
- Astro Docs — Content Collections
- Astro Docs —
astro:contentAPI Reference - Google Search Central — RSS feeds for discovering URLs
Technical disclosure: The tutorial code is a reference implementation with explicit assumptions about the collection name, frontmatter, and blog URL structure. It has not been deployed to or tested against the site’s existing Astro repository. Verify those assumptions before using it in production.






