mirror of
https://github.com/maciejpedzich/maciejpedzi.ch.git
synced 2024-11-27 23:55:47 +01:00
Migrate to Astro 3.0
This commit is contained in:
parent
f948d0b088
commit
387479e05d
4049
package-lock.json
generated
4049
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -13,6 +13,6 @@
|
|||||||
"@astrojs/mdx": "^0.19.0",
|
"@astrojs/mdx": "^0.19.0",
|
||||||
"@astrojs/rss": "^2.3.2",
|
"@astrojs/rss": "^2.3.2",
|
||||||
"@astrojs/sitemap": "^1.2.2",
|
"@astrojs/sitemap": "^1.2.2",
|
||||||
"astro": "^2.3.0"
|
"astro": "^3.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,12 @@ import rss from '@astrojs/rss';
|
|||||||
import { getCollection } from 'astro:content';
|
import { getCollection } from 'astro:content';
|
||||||
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
|
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
|
||||||
|
|
||||||
export async function get(context) {
|
export async function GET(context) {
|
||||||
const posts = (await getCollection('blog')).sort(
|
const posts = (await getCollection('blog')).sort(
|
||||||
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()
|
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()
|
||||||
);
|
);
|
||||||
return rss({
|
|
||||||
|
const { body } = await rss({
|
||||||
title: SITE_TITLE,
|
title: SITE_TITLE,
|
||||||
description: SITE_DESCRIPTION,
|
description: SITE_DESCRIPTION,
|
||||||
site: context.site,
|
site: context.site,
|
||||||
@ -15,4 +16,11 @@ export async function get(context) {
|
|||||||
link: `/blog/${post.slug}/`
|
link: `/blog/${post.slug}/`
|
||||||
}))
|
}))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return new Response(body, {
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/rss+xml'
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user