Migrate to Astro 3.0

This commit is contained in:
Maciej Pędzich 2023-08-31 15:50:20 +02:00
parent f948d0b088
commit 387479e05d
3 changed files with 2407 additions and 1656 deletions

4049
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,6 @@
"@astrojs/mdx": "^0.19.0",
"@astrojs/rss": "^2.3.2",
"@astrojs/sitemap": "^1.2.2",
"astro": "^2.3.0"
"astro": "^3.0.0"
}
}

View File

@ -2,11 +2,12 @@ import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
export async function get(context) {
export async function GET(context) {
const posts = (await getCollection('blog')).sort(
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()
);
return rss({
const { body } = await rss({
title: SITE_TITLE,
description: SITE_DESCRIPTION,
site: context.site,
@ -15,4 +16,11 @@ export async function get(context) {
link: `/blog/${post.slug}/`
}))
});
return new Response(body, {
status: 200,
headers: {
'Content-Type': 'application/rss+xml'
}
});
}