Skip to content

Commit 0514040

Browse files
Merge pull request #76 from WebDevSimplified/fix-og-img
Use only HTTPS
2 parents 2a47164 + 969dd57 commit 0514040

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/components/BaseHead.astro

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ export interface Props {
66
}
77
const { title, description, permalink } = Astro.props
88
const url = new URL(permalink)
9-
const imageHttpUrl = new URL("og.webp", url)
10-
imageHttpUrl.protocol = "http:"
11-
12-
const imageHttpsUrl = new URL(imageHttpUrl)
13-
imageHttpsUrl.protocol = "https:"
9+
const imageUrl = new URL("og.webp", url)
10+
imageUrl.protocol = "https:"
1411
---
1512

1613
<!-- Global Metadata -->
@@ -28,8 +25,8 @@ imageHttpsUrl.protocol = "https:"
2825
<meta property="og:url" content={permalink} />
2926
<meta property="og:title" content={title} />
3027
<meta property="og:description" content={description} />
31-
<meta property="og:image" content={imageHttpUrl.toString()} />
32-
<meta property="og:image:secure_url" content={imageHttpsUrl.toString()} />
28+
<meta property="og:image" content={imageUrl.toString()} />
29+
<meta property="og:image:secure_url" content={imageUrl.toString()} />
3330
<meta property="og:image:width" content="1200" />
3431
<meta property="og:image:height" content="630" />
3532

@@ -38,7 +35,7 @@ imageHttpsUrl.protocol = "https:"
3835
<meta property="twitter:url" content={permalink} />
3936
<meta property="twitter:title" content={title} />
4037
<meta property="twitter:description" content={description} />
41-
<meta property="twitter:image" content={imageHttpUrl.toString()} />
38+
<meta property="twitter:image" content={imageUrl.toString()} />
4239

4340
<!-- Fonts -->
4441
<link rel="preconnect" href="https://fonts.gstatic.com" />

0 commit comments

Comments
 (0)