aboutsummaryrefslogtreecommitdiff
path: root/src/components/OpenGraph.astro
blob: 6ca1856e1e82c9f0c9ad795cc7a2dbb1c2fe55c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---
import { config } from "../config";

type Props = {
	readonly description: string;
	readonly title: string;
};

const canonicalURL = new URL(Astro.url.pathname, Astro.site);
const { description, title } = Astro.props;

const image = new URL(config.posts.defaultImage, Astro.site).toString();
---

<!-- Open Graph -->
<meta property="og:type" content="website" />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:image" content={image} />
<meta property="og:url" content={canonicalURL} />

<!-- Twitter Cards -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={description} />
<meta name="twitter:image" content={image} />