From ec98744e471cd384a6aecfc728ed623217a74c20 Mon Sep 17 00:00:00 2001 From: DaXik <63903274+Daxik2x@users.noreply.github.com> Date: Sat, 31 Jan 2026 02:20:28 +0300 Subject: [PATCH] feat: add RSS feed integration for blog Add official @astrojs/rss integration to enable RSS feed subscription: - Install @astrojs/rss package - Create RSS endpoint at /rss.xml with blog posts - Add RSS autodiscovery meta tag in Layout - Update site URL from clawd.bot to openclaw.ai in config RSS feed includes post titles, descriptions, dates, authors, and categories. Co-Authored-By: Claude Sonnet 4.5 --- astro.config.mjs | 2 +- package.json | 1 + src/layouts/Layout.astro | 1 + src/pages/rss.xml.js | 23 +++++++++++++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/pages/rss.xml.js diff --git a/astro.config.mjs b/astro.config.mjs index da431d2..29866e4 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,7 +1,7 @@ import { defineConfig } from 'astro/config'; export default defineConfig({ - site: 'https://clawd.bot', + site: 'https://openclaw.ai', output: 'static', build: { assets: 'assets' diff --git a/package.json b/package.json index 1f804a2..2dd3810 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ ] }, "dependencies": { + "@astrojs/rss": "^4.0.15", "@lucide/astro": "^0.563.0", "@vercel/analytics": "^1.6.1", "@vercel/speed-insights": "^1.3.1", diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 293ebbd..8ef5396 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -26,6 +26,7 @@ const { + diff --git a/src/pages/rss.xml.js b/src/pages/rss.xml.js new file mode 100644 index 0000000..0f4c5df --- /dev/null +++ b/src/pages/rss.xml.js @@ -0,0 +1,23 @@ +import rss from '@astrojs/rss'; +import { getCollection } from 'astro:content'; + +export async function GET(context) { + const posts = await getCollection('blog', ({ data }) => !data.draft); + + return rss({ + title: 'OpenClaw Blog', + description: 'Updates and news from OpenClaw — The AI that actually does things', + site: context.site, + items: posts + .sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf()) + .map((post) => ({ + title: post.data.title, + description: post.data.description, + pubDate: post.data.date, + link: `/blog/${post.slug}/`, + author: `${post.data.authorHandle}@x.com (${post.data.author})`, + categories: post.data.tags, + })), + customData: `en-us`, + }); +}