Skip to content

Commit 1bd0d54

Browse files
committed
fix: dupplicate og:image
1 parent 3e0aeb1 commit 1bd0d54

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

app/[lang]/[[...mdxPath]]/page.tsx

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,20 @@ export async function generateMetadata({ params }): Promise<Metadata> {
3333
title,
3434
description,
3535
type: 'article',
36-
images: [
37-
...(isPatternPage && patternName ? [{
38-
url: `/covers/patterns/${patternName}.png`,
39-
width: 800,
40-
height: 400,
41-
alt: `${summary} - UX Pattern`,
42-
}] : []),
43-
{
44-
url: ogImageUrl,
45-
width: 1200,
46-
height: 630,
47-
alt: description || title,
48-
},
49-
],
36+
images: isPatternPage && patternName ? [{
37+
url: `/covers/patterns/${patternName}.png`,
38+
width: 800,
39+
height: 400,
40+
alt: `Example of ${patternName} pattern`,
41+
}] : [{
42+
url: ogImageUrl,
43+
width: 1200,
44+
height: 630,
45+
alt: description || title,
46+
}],
5047
},
5148
alternates: {
52-
canonical: `${baseUrl}/${params.lang}${path ? `/${path}` : ''}`,
49+
canonical: `${baseUrl}/en/${path ? `/${path}` : ''}`,
5350
},
5451
}
5552
}
@@ -78,7 +75,7 @@ export default async function Page(props: PageProps) {
7875
const schemaData = generateArticleSchema(
7976
title,
8077
description,
81-
`/${params.lang}/${params.mdxPath?.join('/') || ''}`,
78+
`/en/${params.mdxPath?.join('/') || ''}`,
8279
ogImageUrl
8380
)
8481

@@ -91,13 +88,13 @@ export default async function Page(props: PageProps) {
9188
currentPath += `/${segment}`
9289
breadcrumbs.push({
9390
title: segment.charAt(0).toUpperCase() + segment.slice(1).replace(/-/g, ' '),
94-
url: `/${params.lang}${currentPath}`
91+
url: `/en${currentPath}`
9592
})
9693
}
9794
}
9895

9996
const breadcrumbSchema = generateBreadcrumbSchema(breadcrumbs)
100-
const pageKey = `${params.lang}-${params.mdxPath?.join('-') || 'home'}`
97+
const pageKey = `en-${params.mdxPath?.join('-') || 'home'}`
10198

10299
return (
103100
<>

0 commit comments

Comments
 (0)