init: project setup

This commit is contained in:
cojocaru-david
2025-04-22 13:53:47 +03:00
commit eb9b1a88be
370 changed files with 33387 additions and 0 deletions

25
src/pages/rss.xml.ts Normal file
View File

@@ -0,0 +1,25 @@
import { SITE } from '@/consts'
import rss from '@astrojs/rss'
import type { APIContext } from 'astro'
import { 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) => ({
title: post.data.title,
description: post.data.description,
pubDate: post.data.date,
link: `/blog/${post.id}/`,
})),
})
} catch (error) {
console.error('Error generating RSS feed:', error)
return new Response('Error generating RSS feed', { status: 500 })
}
}