-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPageMeta.astro
More file actions
67 lines (60 loc) · 2.03 KB
/
PageMeta.astro
File metadata and controls
67 lines (60 loc) · 2.03 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
import { getPageMeta } from "../lib/seo";
import {
SITE_TITLE,
SITE_DESCRIPTION,
SITE_URL,
TWITTER_HANDLE,
SITE_BANNER_URL,
} from "../config";
export interface Props {
title?: string;
description?: string;
}
const { title, description } = Astro.props;
const { meta, og, twitter } = getPageMeta({
title: title || SITE_TITLE,
description: description || SITE_DESCRIPTION,
baseUrl: SITE_URL,
ogImageAbsoluteUrl: SITE_BANNER_URL,
ogImageAltText: description || SITE_DESCRIPTION || "",
ogImageWidth: 700,
ogImageHeight: 319,
siteOwnerTwitterHandle: TWITTER_HANDLE,
contentAuthorTwitterHandle: TWITTER_HANDLE,
});
---
<!-- Primary Meta Tags -->
<title>{meta.title}</title>
<meta name="title" content={meta.title} />
{meta.description && <meta name="description" content={meta.description} />}
<!-- Open Graph / Facebook -->
{og.title && <meta property="og:title" content={og.title} />}
{og.description && <meta property="og:description" content={og.description} />}
{og.type && <meta property="og:type" content={og.type} />}
{og.url && <meta property="og:url" content={og.url} />}
{og.image && <meta property="og:image" content={og.image} />}
{og.imageAlt && <meta property="og:image:alt" content={og.imageAlt} />}
{og.imageWidth && <meta property="og:image:width" content={og.imageWidth} />}
{og.imageHeight && <meta property="og:image:height" content={og.imageHeight} />}
<!-- Twitter -->
{twitter.title && <meta property="twitter:title" content={twitter.title} />}
{
twitter.description && (
<meta property="twitter:description" content={twitter.description} />
)
}
{twitter.site && <meta property="twitter:site" content={twitter.site} />}
{
twitter.creator && (
<meta property="twitter:creator" content={twitter.creator} />
)
}
<meta property="twitter:card" content="summary_large_image" />
{twitter.image && <meta property="twitter:image" content={twitter.image} />}
{
twitter.imageAlt && (
<meta property="twitter:image:alt" content={twitter.imageAlt} />
)
}
<!-- {twitter.url && <meta property="twitter:url" content={twitter.url} />} -->