Skip to content

Commit 604f2a5

Browse files
committed
fix: social tags
1 parent 74231f2 commit 604f2a5

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function generateMetadata({ params }): Promise<Metadata> {
3232
openGraph: {
3333
title,
3434
description,
35-
type: 'article',
35+
type: isHomepage ? 'website' : 'article',
3636
images: isPatternPage && patternName ? [{
3737
url: `/covers/patterns/${patternName}.png`,
3838
width: 800,
@@ -45,6 +45,18 @@ export async function generateMetadata({ params }): Promise<Metadata> {
4545
alt: description || title,
4646
}],
4747
},
48+
twitter: {
49+
card: 'summary_large_image',
50+
site: '@thedaviddias',
51+
creator: '@thedaviddias',
52+
images: isPatternPage && patternName ? [{
53+
url: `/covers/patterns/${patternName}.png`,
54+
alt: `Example of ${patternName} pattern`,
55+
}] : [{
56+
url: ogImageUrl,
57+
alt: description || title,
58+
}],
59+
},
4860
alternates: {
4961
canonical: `${baseUrl}/en/${path ? `${path}` : ''}`,
5062
},

app/[lang]/layout.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,23 @@ const fontMono = FontMono({
3030
variable: "--font-mono",
3131
});
3232

33-
export const metadata = metadataSEO
33+
export const metadata = {
34+
...metadataSEO,
35+
openGraph: {
36+
...metadataSEO.openGraph,
37+
type: 'website'
38+
},
39+
twitter: {
40+
...metadataSEO.twitter,
41+
card: 'summary_large_image',
42+
site: '@thedaviddias',
43+
creator: '@thedaviddias',
44+
images: [{
45+
url: '/og/opengraph-image.png',
46+
alt: 'UX Patterns for Developers - A collection of UX patterns for building effective UI components'
47+
}]
48+
}
49+
}
3450

3551
export default async function RootLayout({ children, params }: {
3652
children: React.ReactNode

app/metadata.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ export const metadataSEO: Metadata = {
3636
},
3737
twitter: {
3838
card: 'summary_large_image',
39-
creator: '@thedaviddias'
39+
creator: '@thedaviddias',
40+
site: '@thedaviddias',
41+
images: [{
42+
url: '/og/opengraph-image.png',
43+
alt: 'UX Patterns for Developers - A collection of UX patterns for building effective UI components'
44+
}]
4045
},
4146
appleWebApp: {
4247
title: 'UX Patterns for Devs'

0 commit comments

Comments
 (0)