forked from Bitcoindefi/OpenAO
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseo.ts
More file actions
79 lines (73 loc) · 1.87 KB
/
Copy pathseo.ts
File metadata and controls
79 lines (73 loc) · 1.87 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
68
69
70
71
72
73
74
75
76
77
78
79
import type { Metadata } from "next";
const rawSiteUrl =
process.env.NEXT_PUBLIC_SITE_URL?.trim() ||
process.env.SITE_URL?.trim() ||
process.env.VERCEL_PROJECT_PRODUCTION_URL?.trim() ||
"https://aoweb.app";
const normalizedSiteUrl = rawSiteUrl.startsWith("http")
? rawSiteUrl
: `https://${rawSiteUrl}`;
export const siteUrl = normalizedSiteUrl.replace(/\/+$/, "");
export const siteName = "AOWeb";
export const siteTitle = "AOWeb Beta";
export const siteDescription =
"";
export const siteKeywords = [
"AOWeb",
"AO Web",
"MMORPG web",
"AOWeb beta",
"changelog AOWeb",
"roadmap AOWeb",
];
export function absoluteUrl(path = "/"): string {
return new URL(path, `${siteUrl}/`).toString();
}
type PageMetadataInput = {
title: string;
description: string;
path: string;
keywords?: string[];
imagePath?: string;
twitterImagePath?: string;
};
export function buildPageMetadata({
title,
description,
path,
keywords = [],
imagePath = "/opengraph-image",
twitterImagePath = imagePath,
}: PageMetadataInput): Metadata {
return {
title,
description,
keywords: [...siteKeywords, ...keywords],
alternates: {
canonical: path,
},
openGraph: {
type: "website",
locale: "es_AR",
url: absoluteUrl(path),
siteName,
title,
description,
images: [
{
url: absoluteUrl(imagePath),
width: 1200,
height: 630,
alt: title,
},
],
},
twitter: {
card: "summary_large_image",
creator: "@DamianCatanzaro",
title,
description,
images: [absoluteUrl(twitterImagePath)],
},
};
}