diff --git a/apps/website/app/[locale]/blog/[slug]/page.tsx b/apps/website/app/[locale]/blog/[slug]/page.tsx index 0b6c89a..4ae8bc3 100644 --- a/apps/website/app/[locale]/blog/[slug]/page.tsx +++ b/apps/website/app/[locale]/blog/[slug]/page.tsx @@ -80,282 +80,291 @@ export async function generateStaticParams() { } export default async function BlogPostPage({ params }: Props) { - const { locale, slug } = await params; - // setRequestLocale(locale); - const t = await getTranslations({ locale, namespace: "blog" }); - const post = await getPost(slug); - const allPosts = await getPosts(); + try { + const { locale, slug } = await params; + // setRequestLocale(locale); + const t = await getTranslations({ locale, namespace: "blog" }); + const post = await getPost(slug); + const allPosts = await getPosts(); - // Get related posts (excluding current post) - const relatedPosts = allPosts.filter((p) => p.id !== post?.id).slice(0, 3); // Show only 3 related posts + // Get related posts (excluding current post) + const relatedPosts = allPosts.filter((p) => p.id !== post?.id).slice(0, 3); // Show only 3 related posts - if (!post) { - notFound(); - } + if (!post) { + notFound(); + } - // Convertir HTML a Markdown - const turndownService = new TurndownService({ - headingStyle: "atx", - codeBlockStyle: "fenced", - }); - const gfm = turndownPluginGfm.gfm; - const tables = turndownPluginGfm.tables; - const strikethrough = turndownPluginGfm.strikethrough; - turndownService.use([tables, strikethrough, gfm, remarkToc]); + // Convertir HTML a Markdown + const turndownService = new TurndownService({ + headingStyle: "atx", + codeBlockStyle: "fenced", + }); + const gfm = turndownPluginGfm.gfm; + const tables = turndownPluginGfm.tables; + const strikethrough = turndownPluginGfm.strikethrough; + turndownService.use([tables, strikethrough, gfm, remarkToc]); - const markdown = turndownService.turndown(post.html); + const markdown = turndownService.turndown(post.html); - const formattedDate = new Date(post.published_at).toLocaleDateString(locale, { - year: "numeric", - month: "long", - day: "numeric", - }); + const formattedDate = new Date(post.published_at).toLocaleDateString( + locale, + { + year: "numeric", + month: "long", + day: "numeric", + }, + ); - const components: Partial = { - h1: H1, - h2: H2, - h3: H3, - p: ({ node, children, ...props }) => ( -

- {children} -

- ), - a: ({ node, href, ...props }) => ( - - ), - ul: ({ node, ...props }) => ( -