Skip to content

Commit 2e145f5

Browse files
committed
opengraph
1 parent e58ef4e commit 2e145f5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

public/og-default.png

50.7 KB
Loading

src/components/BaseHead.astro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ interface Props {
88
import { withBase } from "../lib/utils";
99
const { title, description = "The official blog of the Python core development team.", image } = Astro.props;
1010
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
11+
const ogImage = image ? new URL(image, Astro.site) : new URL(withBase("/og-default.png"), Astro.site);
1112
---
1213

1314
<meta charset="utf-8" />
@@ -43,10 +44,11 @@ const canonicalURL = new URL(Astro.url.pathname, Astro.site);
4344
<meta property="og:url" content={canonicalURL} />
4445
<meta property="og:title" content={title} />
4546
<meta property="og:description" content={description} />
46-
{image && <meta property="og:image" content={new URL(image, Astro.site)} />}
47+
<meta property="og:image" content={ogImage} />
48+
<meta property="og:site_name" content="Python Insider" />
4749

4850
<!-- Twitter -->
4951
<meta name="twitter:card" content="summary_large_image" />
5052
<meta name="twitter:title" content={title} />
5153
<meta name="twitter:description" content={description} />
52-
{image && <meta name="twitter:image" content={new URL(image, Astro.site)} />}
54+
<meta name="twitter:image" content={ogImage} />

0 commit comments

Comments
 (0)