Skip to content

Commit 8f59457

Browse files
committed
Update OG image for docs with new brand guidelines
1 parent 1e755c3 commit 8f59457

File tree

4 files changed

+63
-62
lines changed

4 files changed

+63
-62
lines changed

public/sourcegraph-og-nw.png

15.9 KB
Loading

src/app/[...slug]/page.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
1-
import { Breadcrumbs } from '@/components/Breadcrumbs';
1+
import {Breadcrumbs} from '@/components/Breadcrumbs';
22
import MdxComponents from '@/components/MdxComponents';
3-
import { PrevNextLinks } from '@/components/PrevNextLinks';
4-
import { Prose } from '@/components/Prose';
5-
import { TableOfContents } from '@/components/Toc';
6-
import { allPosts } from 'contentlayer/generated';
7-
import { getMDXComponent } from 'next-contentlayer/hooks';
8-
import { notFound } from 'next/navigation';
3+
import {PrevNextLinks} from '@/components/PrevNextLinks';
4+
import {Prose} from '@/components/Prose';
5+
import {TableOfContents} from '@/components/Toc';
6+
import {allPosts} from 'contentlayer/generated';
7+
import {getMDXComponent} from 'next-contentlayer/hooks';
8+
import {notFound} from 'next/navigation';
99

1010
export const maxDuration = 300;
1111

1212
export const generateStaticParams = async () => {
1313
return allPosts.map(post => ({
14-
params: { slug: post._raw.flattenedPath.split('/') }
14+
params: {slug: post._raw.flattenedPath.split('/')}
1515
}));
1616
};
1717

18-
export const generateMetadata = ({ params }: Props) => {
18+
export const generateMetadata = ({params}: Props) => {
1919
const path = params.slug.join('/');
2020
const post = allPosts.find(post => post._raw.flattenedPath === path);
2121
if (post && post.headings && post.headings.length > 0) {
22-
23-
return {
22+
return {
2423
title: post.headings[0].title,
2524
openGraph: {
26-
images: [{url: 'https://sourcegraph.com/docs/sourcegraph-docs-c.png'}]
25+
images: [
26+
{url: 'https://sourcegraph.com/docs/sourcegraph-og-nw.png'}
27+
]
2728
}
2829
};
2930
}
@@ -35,7 +36,7 @@ interface Props {
3536
};
3637
}
3738

38-
const PostLayout = ({ params }: Props) => {
39+
const PostLayout = ({params}: Props) => {
3940
const path = params.slug.join('/');
4041
const post = allPosts.find(post => post._raw.flattenedPath === path);
4142
if (!post) return notFound();

src/app/layout.tsx

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import { Providers } from '@/app/providers';
2-
import { Layout } from '@/components/Layout';
3-
import { GoogleAnalytics } from '@next/third-parties/google';
1+
import {Providers} from '@/app/providers';
2+
import {Layout} from '@/components/Layout';
3+
import {GoogleAnalytics} from '@next/third-parties/google';
44
import clsx from 'clsx';
55
import config from 'docs.config';
6-
import { type Metadata } from 'next';
7-
import { Inter } from 'next/font/google';
6+
import {type Metadata} from 'next';
7+
import {Inter} from 'next/font/google';
88
import localFont from 'next/font/local';
9-
import Chatbot from '@/components/ChatBot';
109

11-
import '@langbase/components/styles'
1210
import '@/styles/tailwind.css';
11+
import '@langbase/components/styles';
1312

1413
const inter = Inter({
1514
subsets: ['latin'],
@@ -30,60 +29,60 @@ export const metadata: Metadata = {
3029
template: '%s - Sourcegraph docs',
3130
default: 'Sourcegraph docs'
3231
},
33-
description: 'Documentation for Sourcegraph, the code intelligence platform.',
32+
description:
33+
'Documentation for Sourcegraph, the code intelligence platform.',
3434
other: {
35-
"docsearch:language": "en",
36-
"docsearch:version": `v${config.DOCS_LATEST_VERSION}`
35+
'docsearch:language': 'en',
36+
'docsearch:version': `v${config.DOCS_LATEST_VERSION}`
3737
},
3838
alternates: {
3939
canonical: '/docs'
4040
},
4141
openGraph: {
42-
images: [{ url: 'https://sourcegraph.com/docs/sourcegraph-docs-c.png' }]
42+
images: [{url: 'https://sourcegraph.com/docs/sourcegraph-og-nw.png'}]
4343
}
4444
};
4545

46-
4746
// PolySans Variable Font
4847
const polySansVariable = localFont({
49-
src: [
50-
{
51-
path: '../fonts/PolySans-Neutral.woff',
52-
style: 'normal',
53-
},
54-
{
55-
path: '../fonts/PolySans-NeutralItalic.woff',
56-
style: 'italic',
57-
}
58-
],
59-
variable: '--font-polysans'
48+
src: [
49+
{
50+
path: '../fonts/PolySans-Neutral.woff',
51+
style: 'normal'
52+
},
53+
{
54+
path: '../fonts/PolySans-NeutralItalic.woff',
55+
style: 'italic'
56+
}
57+
],
58+
variable: '--font-polysans'
6059
});
6160

6261
// PolySans Mono Font
6362
const polySansMono = localFont({
64-
src: [
65-
{
66-
path: '../fonts/PolySans-NeutralMono.woff',
67-
style: 'normal',
68-
},
69-
{
70-
path: '../fonts/PolySans-SlimMono.woff',
71-
style: 'normal',
72-
}
73-
],
74-
variable: '--font-polysans-mono'
63+
src: [
64+
{
65+
path: '../fonts/PolySans-NeutralMono.woff',
66+
style: 'normal'
67+
},
68+
{
69+
path: '../fonts/PolySans-SlimMono.woff',
70+
style: 'normal'
71+
}
72+
],
73+
variable: '--font-polysans-mono'
7574
});
7675

77-
export default function RootLayout({ children }: { children: React.ReactNode }) {
76+
export default function RootLayout({children}: {children: React.ReactNode}) {
7877
return (
7978
<html
8079
lang="en"
81-
style={{ colorScheme: 'dark' }}
80+
style={{colorScheme: 'dark'}}
8281
className={clsx(
83-
'h-full antialiased',
84-
polySansVariable.variable,
85-
polySansMono.variable
86-
)}
82+
'h-full antialiased',
83+
polySansVariable.variable,
84+
polySansMono.variable
85+
)}
8786
suppressHydrationWarning
8887
>
8988
<head>

src/app/page.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import MdxComponents from '@/components/MdxComponents';
2-
import { Prose } from '@/components/Prose';
3-
import { GoogleAnalytics } from '@next/third-parties/google';
4-
import { allPosts } from 'contentlayer/generated';
5-
import { getMDXComponent } from 'next-contentlayer/hooks';
6-
import { notFound } from 'next/navigation';
2+
import {Prose} from '@/components/Prose';
3+
import {GoogleAnalytics} from '@next/third-parties/google';
4+
import {allPosts} from 'contentlayer/generated';
5+
import {getMDXComponent} from 'next-contentlayer/hooks';
6+
import {notFound} from 'next/navigation';
77

88
export const generateMetadata = () => {
99
return {
1010
openGraph: {
11-
images: [{url: 'https://sourcegraph.com/docs/sourcegraph-docs-c.png'}]
11+
images: [
12+
{url: 'https://sourcegraph.com/docs/sourcegraph-og-nw.png'}
13+
]
1214
}
13-
}
14-
}
15+
};
16+
};
1517

1618
const PostLayout = () => {
1719
const post = allPosts.find(post => post._raw.flattenedPath === '');
@@ -29,7 +31,6 @@ const PostLayout = () => {
2931
</div>
3032
<GoogleAnalytics gaId="GTM-TB4NLS7" />
3133
</>
32-
3334
);
3435
};
3536

0 commit comments

Comments
 (0)