@@ -10,7 +10,7 @@ interface Props {
10
10
11
11
const {
12
12
title,
13
- featuredImageSrc = " /favicon.svg " ,
13
+ featuredImageSrc = " /assets/img/p5js.png " ,
14
14
locale,
15
15
description,
16
16
} = Astro .props ;
@@ -28,6 +28,9 @@ const t = await getUiTranslator(locale);
28
28
const localizedTitle = t (title ) as string ;
29
29
const localizedDescription =
30
30
description || (t (" briefPageDescriptions" , title ) as string );
31
+
32
+ const rootUrl = new URL (' /' , process .env .NODE_ENV === " production" ? Astro .site : Astro .url .href );
33
+ const ogpImageSrc = new URL (featuredImageSrc , rootUrl );
31
34
---
32
35
33
36
<head >
@@ -38,14 +41,14 @@ const localizedDescription =
38
41
<meta name =" description" content ={ localizedDescription } />
39
42
<meta property =" og:title" content ={ title } />
40
43
<meta property =" og:description" content ={ localizedDescription } />
41
- <meta property =" og:image" content ={ featuredImageSrc } />
44
+ <meta property =" og:image" content ={ ogpImageSrc } />
42
45
<meta property =" og:url" content ={ Astro .url .href } />
43
46
<meta property =" og:type" content =" website" />
44
47
<meta property =" og:locale" content ={ localeContentMap [locale ]} />
45
48
<meta name =" twitter:card" content =" summary_large_image" />
46
49
<meta name =" twitter:site" content =" @p5xjs" />
47
50
<meta name =" twitter:title" content ={ title } />
48
51
<meta name =" twitter:description" content ={ localizedDescription } />
49
- <meta name =" twitter:image" content ={ featuredImageSrc } />
52
+ <meta name =" twitter:image" content ={ ogpImageSrc } />
50
53
<meta name =" twitter:url" content ={ Astro .url .href } />
51
54
</head >
0 commit comments