Skip to content

Commit 1332d30

Browse files
authored
fix: Fix the og-image on UI library pages (supabase#37439)
* Remove the og-image from the docs pages to see if they're pulled from the main layout. * Merge the doc metadata with the metadata from the main layout.
1 parent f1753e7 commit 1332d30

File tree

3 files changed

+10
-40
lines changed

3 files changed

+10
-40
lines changed

apps/ui-library/app/(app)/docs/[[...slug]]/page.tsx

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import { metadata as mainMetadata } from '@/app/layout'
12
import { FrameworkSelector } from '@/components/framework-selector'
23
import { Mdx } from '@/components/mdx-components'
34
import { SourcePanel } from '@/components/source-panel'
45
import { DashboardTableOfContents } from '@/components/toc'
5-
import { siteConfig } from '@/config/site'
66
import { getTableOfContents } from '@/lib/toc'
77
import { absoluteUrl, cn } from '@/lib/utils'
88
import '@/styles/code-block-variables.css'
@@ -12,7 +12,7 @@ import { ChevronRight } from 'lucide-react'
1212
import type { Metadata } from 'next'
1313
import { notFound } from 'next/navigation'
1414
import Balancer from 'react-wrap-balancer'
15-
import { ScrollArea, Separator } from 'ui'
15+
import { ScrollArea } from 'ui'
1616

1717
interface DocPageProps {
1818
params: Promise<{
@@ -39,31 +39,19 @@ export async function generateMetadata(props: DocPageProps): Promise<Metadata> {
3939
return {}
4040
}
4141

42-
return {
42+
const metadata: Metadata = {
43+
...mainMetadata,
4344
title: doc.title,
4445
description: doc.description,
4546
openGraph: {
47+
...mainMetadata.openGraph,
4648
title: doc.title,
4749
description: doc.description,
4850
type: 'article',
4951
url: absoluteUrl(doc.slug),
50-
images: [
51-
{
52-
url: siteConfig.ogImage,
53-
width: 1200,
54-
height: 630,
55-
alt: siteConfig.name,
56-
},
57-
],
58-
},
59-
twitter: {
60-
card: 'summary_large_image',
61-
title: doc.title,
62-
description: doc.description,
63-
images: [siteConfig.ogImage],
64-
creator: '@shadcn',
6552
},
6653
}
54+
return metadata
6755
}
6856

6957
export async function generateStaticParams(): Promise<{ slug: string[] }[]> {

apps/ui-library/components/site-footer.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import { siteConfig } from '@/config/site'
2-
31
export function SiteFooter() {
42
return (
53
<footer className="py-6 px-4 md:px-8 md:py-0 mx-auto w-full max-w-site">
64
<div className="flex flex-col items-center justify-between gap-4 md:h-24 md:flex-row">
75
<p className="text-balance text-center text-sm leading-loose text-foreground-muted md:text-left">
86
Built by{' '}
97
<a
10-
href={siteConfig.links.twitter}
8+
href="https://twitter.com/supabase"
119
target="_blank"
1210
rel="noreferrer"
1311
className="font-medium underline underline-offset-4 hover:text-foreground-lighter"
@@ -16,7 +14,7 @@ export function SiteFooter() {
1614
</a>
1715
. The source code is available on{' '}
1816
<a
19-
href={siteConfig.links.github}
17+
href="https://github.com/supabase/supabase/tree/master/apps/ui-library"
2018
target="_blank"
2119
rel="noreferrer"
2220
className="font-medium underline underline-offset-4 hover:text-foreground-lighter"
@@ -28,7 +26,7 @@ export function SiteFooter() {
2826
<p className="text-balance text-center text-sm leading-loose text-foreground-muted">
2927
Site inspired by{' '}
3028
<a
31-
href={siteConfig.links.credits.radix}
29+
href="https://www.radix-ui.com/themes/docs/overview/getting-started"
3230
target="_blank"
3331
rel="noreferrer"
3432
className="font-medium underline underline-offset-4 hover:text-foreground-lighter"
@@ -37,7 +35,7 @@ export function SiteFooter() {
3735
</a>
3836
,{' '}
3937
<a
40-
href={siteConfig.links.credits.shadcn}
38+
href="https://ui.shadcn.com"
4139
target="_blank"
4240
rel="noreferrer"
4341
className="font-medium underline underline-offset-4 hover:text-foreground-lighter"

apps/ui-library/config/site.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)