Skip to content

Commit 066ec7b

Browse files
committed
fix website seo
1 parent 3abd570 commit 066ec7b

File tree

4 files changed

+129
-65
lines changed

4 files changed

+129
-65
lines changed

app/(docs)/layout-parts/left-side/left-side.tsx

+22-26
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,59 @@
11
/* eslint-disable react-hooks/exhaustive-deps */
2-
'use client'
2+
"use client";
33

4-
import React, { useState, useEffect } from "react"
5-
import { usePathname } from "next/navigation"
6-
import Link from "next/link"
7-
import { ChevronDown, ChevronRight, Search } from "lucide-react"
8-
import { cn } from "@/lib/utils"
9-
import { Button } from "@/components/ui/button"
4+
import React, { useState, useEffect } from "react";
5+
import { usePathname } from "next/navigation";
6+
import Link from "next/link";
7+
import { ChevronDown, ChevronRight, Search } from "lucide-react";
8+
import { cn } from "@/lib/utils";
9+
import { Button } from "@/components/ui/button";
1010

11-
import { ScrollArea } from "@/components/ui/scroll-area"
11+
import { ScrollArea } from "@/components/ui/scroll-area";
1212
import {
1313
Collapsible,
1414
CollapsibleContent,
1515
CollapsibleTrigger,
16-
} from "@/components/ui/collapsible"
16+
} from "@/components/ui/collapsible";
1717

1818
// Assuming DOCS is imported from your constant file
19-
import { DOCS } from "@/app/(docs)/layout-parts/documentation.constant"
19+
import { DOCS } from "@/app/(docs)/layout-parts/documentation.constant";
2020

2121
export default function EnhancedSidebar() {
2222
const [openGroups, setOpenGroups] = useState<string[]>(
2323
DOCS.map((group) => group.groupKey)
24-
)
25-
const [searchTerm, setSearchTerm] = useState("")
26-
const pathname = usePathname()
24+
);
25+
const [searchTerm, setSearchTerm] = useState("");
26+
const pathname = usePathname();
2727

2828
useEffect(() => {
2929
// Ensure the group of the active link is open
3030
const activeGroup = DOCS.find((group) =>
3131
group.children.some((child) => child.url === pathname)
32-
)
32+
);
3333
if (activeGroup && !openGroups.includes(activeGroup.groupKey)) {
34-
setOpenGroups((prev) => [...prev, activeGroup.groupKey])
34+
setOpenGroups((prev) => [...prev, activeGroup.groupKey]);
3535
}
36-
}, [pathname])
36+
}, [pathname]);
3737

3838
const toggleGroup = (groupKey: string) => {
3939
setOpenGroups((prev) =>
4040
prev.includes(groupKey)
4141
? prev.filter((key) => key !== groupKey)
4242
: [...prev, groupKey]
43-
)
44-
}
43+
);
44+
};
4545

46-
47-
const filteredDocs = DOCS
48-
.map((group) => ({
46+
const filteredDocs = DOCS.map((group) => ({
4947
...group,
5048
children: group.children
5149
.filter((child) =>
5250
child.label.toLowerCase().includes(searchTerm.toLowerCase())
5351
)
5452
.sort((a, b) => a.label.localeCompare(b.label)),
55-
}))
56-
.filter((group) => group.children.length > 0)
53+
})).filter((group) => group.children.length > 0);
5754

5855
return (
5956
<aside className="hidden lg:flex flex-col w-64 h-screen sticky top-0 border-r border-gray-200 dark:border-gray-800">
60-
6157
<ScrollArea className="flex-1">
6258
<nav className="p-4 space-y-2">
6359
{filteredDocs.map((group) => (
@@ -105,5 +101,5 @@ export default function EnhancedSidebar() {
105101
</nav>
106102
</ScrollArea>
107103
</aside>
108-
)
109-
}
104+
);
105+
}

app/layout.tsx

+66-27
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1+
// layout.tsx
12
import type { Metadata } from "next";
23
import { ThemeProvider } from "@/components/theme-provider";
34
import { Navbar } from "@/components/navbar";
45
import { GeistSans } from "geist/font/sans";
56
import { GeistMono } from "geist/font/mono";
6-
import Footer from "@/components/footer";
7+
import Footer from "@/components/footer";
78
import "./globals.css";
89
import { inject } from '@vercel/analytics';
910
import { siteConfig } from "@/config/site"
1011
import { Analytics } from "@vercel/analytics/react"
1112
import { SpeedInsights } from '@vercel/speed-insights/next';
12-
13+
import Script from 'next/script';
14+
import Image from 'next/image';
15+
16+
// Inject Vercel Analytics
17+
inject();
1318

1419
export const metadata: Metadata = {
1520
title: {
@@ -37,36 +42,34 @@ export const metadata: Metadata = {
3742
"bootstrap",
3843
"tailwind",
3944
"aceternity",
40-
"shadcn ui"
45+
"shadcn ui",
46+
...siteConfig.keywords,
4147
],
4248
authors: [
4349
{
4450
name: "spectrum ui",
45-
url: "https://spectrumui.arihant.us",
51+
url: siteConfig.url,
52+
},
53+
{
54+
name: siteConfig.author.name,
55+
url: siteConfig.author.url,
4656
},
4757
],
4858
creator: "Arihant Jain & Aman Jain",
4959
openGraph: {
5060
type: "website",
51-
locale: "en_US",
61+
locale: siteConfig.locale,
5262
url: siteConfig.url,
5363
title: siteConfig.name,
5464
description: siteConfig.description,
5565
siteName: siteConfig.name,
56-
images: [
57-
{
58-
url: siteConfig.ogImage,
59-
width: 1200,
60-
height: 630,
61-
alt: siteConfig.name,
62-
},
63-
],
66+
images: [siteConfig.ogImage],
6467
},
6568
twitter: {
6669
card: "summary_large_image",
6770
title: siteConfig.name,
6871
description: siteConfig.description,
69-
images: [siteConfig.ogImage],
72+
images: [siteConfig.ogImage.url],
7073
creator: "@arihantcodes",
7174
},
7275
icons: {
@@ -75,44 +78,80 @@ export const metadata: Metadata = {
7578
apple: "/apple-touch-icon.png",
7679
},
7780
manifest: `${siteConfig.url}/site.webmanifest`,
81+
robots: {
82+
index: true,
83+
follow: true,
84+
googleBot: {
85+
index: true,
86+
follow: true,
87+
'max-video-preview': -1,
88+
'max-image-preview': 'large',
89+
'max-snippet': -1,
90+
},
91+
},
92+
alternates: {
93+
canonical: siteConfig.url,
94+
languages: {
95+
'en-US': siteConfig.url,
96+
},
97+
},
98+
viewport: {
99+
width: 'device-width',
100+
initialScale: 1,
101+
maximumScale: 1,
102+
},
103+
themeColor: siteConfig.themeColor,
78104
}
79105

80-
81-
interface RootLayoutProps {
82-
children: React.ReactNode
83-
}
84-
85-
inject();
86106
export default function RootLayout({
87107
children,
88108
}: Readonly<{
89109
children: React.ReactNode;
90110
}>) {
91111
return (
92-
<html lang="en" suppressHydrationWarning>
112+
<html lang={siteConfig.locale.split('-')[0]} suppressHydrationWarning>
113+
<head>
114+
<link rel="canonical" href={siteConfig.url} />
115+
<Script
116+
id="schema-org"
117+
type="application/ld+json"
118+
dangerouslySetInnerHTML={{
119+
__html: JSON.stringify({
120+
"@context": "https://schema.org",
121+
"@type": "WebSite",
122+
name: siteConfig.name,
123+
url: siteConfig.url,
124+
description: siteConfig.description,
125+
author: {
126+
"@type": "Person",
127+
name: siteConfig.author.name,
128+
url: siteConfig.author.url,
129+
},
130+
license: siteConfig.license,
131+
version: siteConfig.version,
132+
})
133+
}}
134+
/>
135+
</head>
93136
<body
94137
className={`${GeistSans.variable} ${GeistMono.variable} font-regular`}
95138
suppressHydrationWarning
96139
>
97-
98140
<ThemeProvider
99141
attribute="class"
100142
defaultTheme="system"
101143
enableSystem
102144
disableTransitionOnChange
103145
>
104-
<Analytics />
146+
<Analytics />
105147
<Navbar />
106148
<main className="sm:container mx-auto w-[85vw] h-auto">
107149
{children}
108150
</main>
109151
<Footer />
110-
111-
112152
</ThemeProvider>
113-
114153
<SpeedInsights />
115154
</body>
116155
</html>
117156
);
118-
}
157+
}

config/site.ts

+41-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,42 @@
1+
// siteConfig.ts
12
export const siteConfig = {
2-
name: "Spectrum UI",
3-
url: "https://spectrumui.arihant.us",
4-
ogImage: "https://spectrumui.arihant.us/og.jpg",
5-
description:
6-
"Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.",
7-
links: {
8-
twitter: "https://x.com/arihantcodes",
9-
github: "https://github.com/arihantcodes",
10-
},
11-
}
12-
13-
export type SiteConfig = typeof siteConfig
3+
name: "Spectrum UI",
4+
url: "https://spectrumui.arihant.us",
5+
ogImage: {
6+
url: "https://spectrumui.arihant.us/og.png",
7+
width: 1200,
8+
height: 630,
9+
alt: "Spectrum UI - Beautiful and accessible React components",
10+
},
11+
description:
12+
"Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.",
13+
links: {
14+
twitter: "https://x.com/arihantcodes",
15+
github: "https://github.com/arihantcodes",
16+
linkedin: "https://www.linkedin.com/in/arihantcodes", // Update with your actual LinkedIn profile
17+
// Update if you have a Facebook page
18+
instagram: "https://www.instagram.com/arihantjainn18", // Update with your actual Instagram profile
19+
},
20+
author: {
21+
name: "Arihant Jain",
22+
url: "https://arihant.us",
23+
},
24+
keywords: [
25+
"UI components",
26+
"React",
27+
"Next.js",
28+
"Tailwind CSS",
29+
"Accessible design",
30+
"Open source",
31+
"Web development",
32+
"Frontend",
33+
"Design system",
34+
"Spectrum UI",
35+
],
36+
locale: "en-US",
37+
version: "1.0.0",
38+
license: "MIT",
39+
themeColor: "#000000", // Replace with your actual theme color
40+
}
41+
42+
export type SiteConfig = typeof siteConfig

public/og.png

186 KB
Loading

0 commit comments

Comments
 (0)