Skip to content

Commit 633a759

Browse files
committed
chore: update meta tags
1 parent 53a09a1 commit 633a759

2 files changed

Lines changed: 94 additions & 2 deletions

File tree

src/app/(docs)/[...slug]/page.tsx

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
DocsTitle,
77
} from "fumadocs-ui/page";
88
import { notFound } from "next/navigation";
9+
import type { Metadata } from "next";
910
import { LLMCopyButton, ViewOptions } from "@/components/page-actions";
1011
import { VersionBanner } from "@/components/version-banner";
1112
import { source } from "@/lib/source";
@@ -56,13 +57,45 @@ export async function generateStaticParams() {
5657

5758
export async function generateMetadata(props: {
5859
params: Promise<{ slug?: string[] }>;
59-
}) {
60+
}): Promise<Metadata> {
6061
const params = await props.params;
6162
const page = source.getPage(params.slug);
6263
if (!page) notFound();
6364

65+
const url = `https://docs.openzeppelin.com${page.url}`;
66+
6467
return {
6568
title: page.data.title,
66-
description: page.data.description,
69+
description:
70+
page.data.description ||
71+
"The official documentation for OpenZeppelin Libraries and Tools",
72+
openGraph: {
73+
title: page.data.title,
74+
description:
75+
page.data.description ||
76+
"The official documentation for OpenZeppelin Libraries and Tools",
77+
url,
78+
siteName: "OpenZeppelin Docs",
79+
type: "article",
80+
images: [
81+
{
82+
url: "/social.png",
83+
width: 1200,
84+
height: 630,
85+
alt: page.data.title,
86+
},
87+
],
88+
},
89+
twitter: {
90+
card: "summary_large_image",
91+
title: page.data.title,
92+
description:
93+
page.data.description ||
94+
"The official documentation for OpenZeppelin Libraries and Tools",
95+
images: ["/social.png"],
96+
},
97+
alternates: {
98+
canonical: url,
99+
},
67100
};
68101
}

src/app/layout.tsx

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,71 @@
11
import "@/app/global.css";
22
import { Inter } from "next/font/google";
3+
import type { Metadata } from "next";
34
import type { ReactNode } from "react";
45
import { Provider } from "./provider";
56

67
const inter = Inter({
78
subsets: ["latin"],
89
});
910

11+
export const metadata: Metadata = {
12+
title: {
13+
default: "OpenZeppelin Docs",
14+
template: "%s | OpenZeppelin Docs",
15+
},
16+
description:
17+
"The official documentation for OpenZeppelin Libraries and Tools",
18+
keywords: [
19+
"OpenZeppelin",
20+
"smart contracts",
21+
"Ethereum",
22+
"Solidity",
23+
"blockchain",
24+
"security",
25+
"DeFi",
26+
"documentation",
27+
],
28+
creator: "OpenZeppelin",
29+
publisher: "OpenZeppelin",
30+
openGraph: {
31+
type: "website",
32+
locale: "en_US",
33+
url: "https://docs.openzeppelin.com",
34+
siteName: "OpenZeppelin Docs",
35+
title: "OpenZeppelin Docs",
36+
description:
37+
"The official documentation for OpenZeppelin Libraries and Tools",
38+
images: [
39+
{
40+
url: "/social.png",
41+
width: 1200,
42+
height: 630,
43+
alt: "OpenZeppelin Docs",
44+
},
45+
],
46+
},
47+
twitter: {
48+
card: "summary_large_image",
49+
site: "@OpenZeppelin",
50+
creator: "@OpenZeppelin",
51+
title: "OpenZeppelin Docs",
52+
description:
53+
"The official documentation for OpenZeppelin Libraries and Tools",
54+
images: ["/social.png"],
55+
},
56+
robots: {
57+
index: true,
58+
follow: true,
59+
googleBot: {
60+
index: true,
61+
follow: true,
62+
"max-video-preview": -1,
63+
"max-image-preview": "large",
64+
"max-snippet": -1,
65+
},
66+
},
67+
};
68+
1069
export default function Layout({ children }: { children: ReactNode }) {
1170
return (
1271
<html lang="en" className={inter.className} suppressHydrationWarning>

0 commit comments

Comments
 (0)