Skip to content

Commit aeee3a7

Browse files
committed
-
1 parent 64e8004 commit aeee3a7

File tree

4 files changed

+30
-8
lines changed

4 files changed

+30
-8
lines changed

website-v3/api/OgComponent.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
type Props = {
2+
owner: string;
3+
repository: string;
4+
};
5+
6+
export const OgComponent = (props: Props) => {
7+
return (
8+
<div
9+
style={{
10+
width: '100%',
11+
height: '100%',
12+
display: 'flex',
13+
alignItems: 'center',
14+
justifyContent: 'center',
15+
}}
16+
>
17+
<h1>Open Graph Component</h1>
18+
</div>
19+
);
20+
};

website-v3/api/og.tsx renamed to website-v3/api/og.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ImageResponse } from '@vercel/og';
2+
import { OgComponent } from './OgComponent';
23

34
// Note; this API route is deployed to Vercel separatly from Astro since it
45
// needs to run on the edge.
@@ -20,11 +21,8 @@ export default function handler(req: Request) {
2021
const domain = params.get('domain');
2122
const logo = params.get('logo');
2223

23-
return new ImageResponse(
24-
<div tw="w-full h-full flex flex-col items-center justify-center bg-white">Hello world!</div>,
25-
{
26-
width: 1200,
27-
height: 600,
28-
},
29-
);
24+
return new ImageResponse(OgComponent({ owner, repository }), {
25+
width: 1200,
26+
height: 600,
27+
});
3028
}

website-v3/astro.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import tailwind from '@astrojs/tailwind';
33
import node from '@astrojs/node';
44
import vercel from '@astrojs/vercel/serverless';
55
import react from '@astrojs/react';
6+
import prefetch from '@astrojs/prefetch';
67

78
// https://astro.build/config
89

@@ -12,5 +13,5 @@ import react from '@astrojs/react';
1213
export default defineConfig({
1314
output: 'server',
1415
adapter: process.env.VERCEL ? vercel() : node({ mode: 'standalone' }),
15-
integrations: [tailwind(), react()],
16+
integrations: [tailwind(), react(), prefetch()],
1617
});

website-v3/src/layouts/Sidebar.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
import Link from '@components/Link';
33
import context from 'src/context';
4+
import { isExternalLink } from 'src/utils';
45
56
const sidebar = context.get().config.sidebar || [];
67
---
@@ -16,6 +17,7 @@ const sidebar = context.get().config.sidebar || [];
1617
href={urlOrChildren}
1718
className="mb-3 block font-medium tracking-wide opacity-75 transition hover:opacity-100"
1819
activeClassName="text-docs-theme opacity-100"
20+
rel={isExternalLink(urlOrChildren) ? 'noopener noreferrer' : 'prefetch'}
1921
>
2022
{title}
2123
</Link>
@@ -33,6 +35,7 @@ const sidebar = context.get().config.sidebar || [];
3335
href={url}
3436
className="hover:border-docs-theme relative -left-px block border-l border-transparent pl-4 opacity-75 transition hover:opacity-100"
3537
activeClassName="border-docs-theme opacity-100 font-semibold tracking-wide text-docs-theme"
38+
rel={isExternalLink(url) ? 'noopener noreferrer' : 'prefetch'}
3639
>
3740
{title}
3841
</Link>

0 commit comments

Comments
 (0)