Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
Enable dynamic blog slug route
Browse files Browse the repository at this point in the history
  • Loading branch information
vandorsx committed Jun 6, 2024
1 parent ad7960a commit dd138c0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/blog/_[slug]/page.tsx → app/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ type Props = {
};
};

export async function generateStaticParams() {
const posts = (await getPosts(PostReturn.MATTER_ONLY)) as PostMatter[];
return posts.map((post) => ({
slug: post.slug,
}));
}

export async function generateMetadata({ params }: Props): Promise<Metadata> {
const post = (await getPostBySlug(params.slug, PostReturn.FULL)) as Post;
return {
Expand All @@ -26,13 +33,6 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
};
}

export async function generateStaticParams() {
const posts = (await getPosts(PostReturn.MATTER_ONLY)) as PostMatter[];
return posts.map((post) => ({
slug: post.slug,
}));
}

export default async function BlogPost({
params,
}: {
Expand Down

0 comments on commit dd138c0

Please sign in to comment.