diff --git a/src/pages/blog/personal/[id].astro b/src/pages/blog/personal/[id].astro index e2a6222..b7af1a2 100644 --- a/src/pages/blog/personal/[id].astro +++ b/src/pages/blog/personal/[id].astro @@ -1,18 +1,25 @@ --- import { getCollection, render } from 'astro:content'; import BlogPost from '@layouts/BlogPost.astro'; +import type { + InferGetStaticParamsType, + InferGetStaticPropsType, + GetStaticPaths, +} from "astro"; -export async function getStaticPaths() { +export const getStaticPaths = (async () => { const posts = await getCollection('personal'); return posts.map(post => ({ params: { id: post.id }, props: { post }, })); -} +}) satisfies GetStaticPaths; +type Params = InferGetStaticParamsType; +type Props = InferGetStaticPropsType; -type Props = CollectionEntry<'blog'>; -const { post } = Astro.props; +const { post } = Astro.props as Props; +const { id } = Astro.params as Params; const { Content } = await render(post); --- diff --git a/src/pages/blog/university/[id].astro b/src/pages/blog/university/[id].astro index 24b3c90..681fbd6 100644 --- a/src/pages/blog/university/[id].astro +++ b/src/pages/blog/university/[id].astro @@ -1,16 +1,21 @@ --- import { getCollection, render } from 'astro:content'; import BlogPost from '@layouts/BlogPost.astro'; +import type { + InferGetStaticParamsType, + InferGetStaticPropsType, + GetStaticPaths, +} from "astro"; -export async function getStaticPaths() { +export const getStaticPaths = (async () => { const posts = await getCollection('uni'); return posts.map(post => ({ params: { id: post.id }, props: { post }, })); -} - -type Props = CollectionEntry<'blog'>; +}) satisfies GetStaticPaths; +type Params = InferGetStaticParamsType; +type Props = InferGetStaticPropsType; const { post } = Astro.props; const { Content } = await render(post);