File tree Expand file tree Collapse file tree 4 files changed +30
-8
lines changed Expand file tree Collapse file tree 4 files changed +30
-8
lines changed Original file line number Diff line number Diff line change
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
+ } ;
Original file line number Diff line number Diff line change 1
1
import { ImageResponse } from '@vercel/og' ;
2
+ import { OgComponent } from './OgComponent' ;
2
3
3
4
// Note; this API route is deployed to Vercel separatly from Astro since it
4
5
// needs to run on the edge.
@@ -20,11 +21,8 @@ export default function handler(req: Request) {
20
21
const domain = params . get ( 'domain' ) ;
21
22
const logo = params . get ( 'logo' ) ;
22
23
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
+ } ) ;
30
28
}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import tailwind from '@astrojs/tailwind';
3
3
import node from '@astrojs/node' ;
4
4
import vercel from '@astrojs/vercel/serverless' ;
5
5
import react from '@astrojs/react' ;
6
+ import prefetch from '@astrojs/prefetch' ;
6
7
7
8
// https://astro.build/config
8
9
@@ -12,5 +13,5 @@ import react from '@astrojs/react';
12
13
export default defineConfig ( {
13
14
output : 'server' ,
14
15
adapter : process . env . VERCEL ? vercel ( ) : node ( { mode : 'standalone' } ) ,
15
- integrations : [ tailwind ( ) , react ( ) ] ,
16
+ integrations : [ tailwind ( ) , react ( ) , prefetch ( ) ] ,
16
17
} ) ;
Original file line number Diff line number Diff line change 1
1
---
2
2
import Link from ' @components/Link' ;
3
3
import context from ' src/context' ;
4
+ import { isExternalLink } from ' src/utils' ;
4
5
5
6
const sidebar = context .get ().config .sidebar || [];
6
7
---
@@ -16,6 +17,7 @@ const sidebar = context.get().config.sidebar || [];
16
17
href = { urlOrChildren }
17
18
className = " mb-3 block font-medium tracking-wide opacity-75 transition hover:opacity-100"
18
19
activeClassName = " text-docs-theme opacity-100"
20
+ rel = { isExternalLink (urlOrChildren ) ? ' noopener noreferrer' : ' prefetch' }
19
21
>
20
22
{ title }
21
23
</Link >
@@ -33,6 +35,7 @@ const sidebar = context.get().config.sidebar || [];
33
35
href = { url }
34
36
className = " hover:border-docs-theme relative -left-px block border-l border-transparent pl-4 opacity-75 transition hover:opacity-100"
35
37
activeClassName = " border-docs-theme opacity-100 font-semibold tracking-wide text-docs-theme"
38
+ rel = { isExternalLink (url ) ? ' noopener noreferrer' : ' prefetch' }
36
39
>
37
40
{ title }
38
41
</Link >
You can’t perform that action at this time.
0 commit comments