feat: some shit

This commit is contained in:
2024-03-26 16:36:18 +01:00
commit f0129ecc76
31 changed files with 5074 additions and 0 deletions

View File

@ -0,0 +1,26 @@
import { getCollection } from 'astro:content';
export async function GET({ params }: { params: { slug: string } }) {
const pages = await getCollection('blog');
return new Response(
JSON.stringify(pages.filter(post => {
return post.id.includes(params.slug)
})
))
}
export async function getStaticPaths() {
const pages = await getCollection('blog');
return pages.map(p => {
const [postId] = p.id.split('/');
return {
params: {
slug: postId
}
}
});
}