Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
sistematico committed Dec 13, 2024
1 parent a33eede commit 654bfc9
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions app/posts/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ export async function generateStaticParams() {
}

export async function generateMetadata({ params }: { params: { slug: string } }) {
let post = await getBlogPosts().find((post) => post.slug === params.slug)
if (!post) {
return
}
const post = (await getBlogPosts()).find((post) => post.slug === params.slug)
if (!post) return

let {
title,
Expand Down Expand Up @@ -52,11 +50,8 @@ export async function generateMetadata({ params }: { params: { slug: string } })
}

export default async function Blog({ params }: { params: { slug: string } }) {
let post = await getBlogPosts().find((post) => post.slug === params.slug)

if (!post) {
notFound()
}
const post = (await getBlogPosts()).find((post) => post.slug === params.slug)
if (!post) notFound()

return (
<section>
Expand All @@ -74,7 +69,7 @@ export default async function Blog({ params }: { params: { slug: string } }) {
image: post.metadata.image
? `${baseUrl}${post.metadata.image}`
: `/og?title=${encodeURIComponent(post.metadata.title)}`,
url: `${baseUrl}/blog/${post.slug}`,
url: `${baseUrl}/posts/${post.slug}`,
author: {
'@type': 'Person',
name: 'My Portfolio',
Expand Down

0 comments on commit 654bfc9

Please sign in to comment.