Skip to content

Commit 59a64b1

Browse files
committed
📣 SEO stuff: metadata, sitemap and robots
1 parent 7c0f950 commit 59a64b1

File tree

7 files changed

+61
-5
lines changed

7 files changed

+61
-5
lines changed

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

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ import { notFound } from "next/navigation";
44
import { format } from "date-fns";
55
import MDX from "@/components/MDX";
66
import { H2 } from "@/packages/ui";
7+
import { Metadata } from "next";
78

8-
function getDocParams(slug: string) {
9+
interface IProps {
10+
params: { slug: string[] };
11+
}
12+
13+
function getDocParams({ params }: IProps) {
14+
const slug = `/docs${params.slug ? `/${params.slug.join("/")}` : ""}`;
915
const doc = allDocs.find((doc) => doc.url === slug);
1016

1117
if (!doc) {
@@ -15,9 +21,23 @@ function getDocParams(slug: string) {
1521
return doc;
1622
}
1723

18-
export default function page({ params }: { params: { slug: string[] } }) {
19-
const slug = `/docs${params.slug ? `/${params.slug.join("/")}` : ""}`;
20-
const doc = getDocParams(slug);
24+
export async function generateMetadata({ params }: IProps): Promise<Metadata> {
25+
const doc = getDocParams({ params });
26+
27+
if (!doc) {
28+
return {
29+
title: "Not Found | Retro UI",
30+
};
31+
}
32+
33+
return {
34+
title: `${doc.title} | Retro UI`,
35+
description: doc.description
36+
};
37+
}
38+
39+
export default function page({ params }: IProps) {
40+
const doc = getDocParams({ params });
2141

2242
if (!doc) {
2343
return notFound();

app/(marketing)/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { JoinNewsletter } from "@/components";
21
import {
32
Accordion,
43
Avatar,

app/favicon.ico

15 KB
Binary file not shown.

app/layout.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import TopNav from "@/components/TopNav";
22
import "./global.css";
33
import { Archivo_Black, Share_Tech, Share_Tech_Mono } from "next/font/google";
4+
import { Metadata } from "next";
45

56
const archivoBlack = Archivo_Black({
67
subsets: ["latin"],
@@ -20,6 +21,14 @@ const shareTechMono = Share_Tech_Mono({
2021
variable: "--font-mono",
2122
});
2223

24+
export const metadata: Metadata = {
25+
title: "Retro Styled Tailwind UI Library | Retro UI",
26+
description: "RetroUI - Retro styled TailwindCSS component library for modern web apps.",
27+
openGraph: {
28+
images: ['/banner.png']
29+
}
30+
};
31+
2332
export default function RootLayout({
2433
children,
2534
}: {

app/robots.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { MetadataRoute } from 'next'
2+
3+
export default function robots(): MetadataRoute.Robots {
4+
return {
5+
rules: {
6+
userAgent: '*',
7+
allow: '/',
8+
},
9+
sitemap: 'https://retroui.dev/sitemap.xml',
10+
}
11+
}

app/sitemap.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { allDocs } from "@/.contentlayer/generated";
2+
import type { MetadataRoute } from "next";
3+
4+
export default function sitemap(): MetadataRoute.Sitemap {
5+
return [
6+
{
7+
url: "https://retroui.dev",
8+
lastModified: new Date(),
9+
changeFrequency: "yearly",
10+
priority: 1,
11+
},
12+
...allDocs.map((doc) => ({
13+
url: `https://retroui.dev${doc.url}`,
14+
lastModified: doc.lastUpdated,
15+
})),
16+
];
17+
}

public/banner.png

310 KB
Loading

0 commit comments

Comments
 (0)