From 90aaf37ff84c49d1bf2716dba89b888b728b737e Mon Sep 17 00:00:00 2001 From: Nolawz Date: Fri, 13 Mar 2026 09:25:54 +0530 Subject: Fixed rss link and added events to rss --- src/pages/rss.xml.ts | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/pages/rss.xml.ts') diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts index fe7e9d2..9cfd560 100644 --- a/src/pages/rss.xml.ts +++ b/src/pages/rss.xml.ts @@ -1,22 +1,32 @@ import { SITE } from '@/consts' import rss from '@astrojs/rss' import type { APIContext } from 'astro' -import { getAllPosts } from '@/lib/data-utils' +import { getAllEvents, getAllPosts } from '@/lib/data-utils' export async function GET(context: APIContext) { try { const posts = await getAllPosts() - - return rss({ - title: SITE.title, - description: SITE.description, - site: context.site ?? SITE.href, - items: posts.map((post) => ({ + const events = await getAllEvents() + const items = [ + ...posts.map((post) => ({ title: post.data.title, description: post.data.description, pubDate: post.data.date, link: `/blog/${post.id}/`, })), + ...events.map((event) => ({ + title: event.data.title, + description: event.data.description, + pubDate: event.data.date, + link: `/events/${event.id}/`, + })) + ] + + return rss({ + title: SITE.title, + description: SITE.description, + site: context.site ?? SITE.href, + items: items }) } catch (error) { console.error('Error generating RSS feed:', error) -- cgit v1.2.3