Skip to content

Commit

Permalink
Fix the post display issue
Browse files Browse the repository at this point in the history
  • Loading branch information
noobnooc committed Oct 11, 2024
1 parent dc89620 commit 3e5bc6a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ export const runtime = "edge";
export async function generateMetadata({
params,
}: {
params: { lang: string; slug: string };
params: { lang: Language; postSlug: string };
}): Promise<Metadata> {
const dictionary = await getDictionary(params.lang);

const postSlug = params.slug;
const { lang, postSlug } = params;
const dictionary = await getDictionary(lang);

const post = posts.find(
(post) => post.lang === params.lang && post.slug === postSlug,
(post) => post.lang === lang && post.slug === postSlug,
);

console.log("###", post);

if (!post) {
notFound();
}
Expand Down Expand Up @@ -54,14 +55,15 @@ export default async function PostPage({
}: {
params: {
lang: Language;
slug: string[];
postSlug: string;
};
}) {
const dictionary = await getDictionary(params.lang);
const [postSlug] = params.slug;
const { lang, postSlug } = params;

const dictionary = await getDictionary(lang);

const post = posts.find(
(post) => post.lang === params.lang && post.slug === postSlug,
(post) => post.lang === lang && post.slug === postSlug,
);

const otherLanguages = posts.filter(
Expand Down

0 comments on commit 3e5bc6a

Please sign in to comment.