Skip to content

Commit ab5d713

Browse files
committed
feat: Integrate structured data for SEO with JsonLd component and update website schema references
1 parent 9eccde5 commit ab5d713

6 files changed

Lines changed: 12 additions & 16 deletions

File tree

app/layout.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { Metadata } from "next";
44
import Header from "@/components/Header";
55
import Footer from "@/components/Footer";
66
import CookieBanner from "@/components/CookieBanner";
7+
import JsonLd from "@/components/JsonLd";
78
import Script from "next/script";
89
import localFont from "next/font/local";
910
import {
@@ -13,6 +14,8 @@ import {
1314
SITE_LOCALE,
1415
SITE_NAME,
1516
SITE_URL,
17+
buildOrganizationSchema,
18+
buildWebsiteSchema,
1619
} from "@/lib/seo";
1720

1821
const generalSans = localFont({
@@ -144,6 +147,7 @@ export default function RootLayout({
144147
)}
145148
</head>
146149
<body suppressHydrationWarning>
150+
<JsonLd data={[buildWebsiteSchema(), buildOrganizationSchema()]} />
147151
<Container>
148152
<Header />
149153
{children}

app/page.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import Subheading from "@/components/Subheading";
88
import Sidebar from "@/components/Sidebar";
99
import { Suspense } from "react";
1010
import type { Metadata } from "next";
11-
import JsonLd from "@/components/JsonLd";
1211
import { db } from "@/lib/firebase";
1312
import {
1413
DEFAULT_OG_IMAGE_PATH,
@@ -17,8 +16,6 @@ import {
1716
SITE_LOCALE,
1817
SITE_NAME,
1918
SITE_URL,
20-
buildOrganizationSchema,
21-
buildWebsiteSchema,
2219
} from "@/lib/seo";
2320
import {
2421
collection,
@@ -156,11 +153,8 @@ async function getData() {
156153
export default async function Home() {
157154
const { articles, shuffledAuthors } = await getData();
158155

159-
const jsonLd = [buildWebsiteSchema(), buildOrganizationSchema()];
160-
161156
return (
162157
<main className="flex flex-col min-h-screen max-w-[95rem] w-full mx-auto px-4 lg:pt-0 sm:pt-4 xs:pt-2 lg:pb-4 md:pb-4 sm:pb-2 xs:pb-2">
163-
<JsonLd data={jsonLd} />
164158
<PageTitle
165159
className="sr-only"
166160
imgSrc="/images/titles/lap-docs.svg"

app/posts/page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
DEFAULT_TWITTER_IMAGE_PATH,
1111
SITE_LOCALE,
1212
SITE_NAME,
13+
SITE_WEBSITE_ID,
1314
absoluteUrl,
1415
buildBreadcrumbSchema,
1516
} from "@/lib/seo";
@@ -138,9 +139,7 @@ export default async function MagazinePage() {
138139
description: "Browse the latest L.A.P - Docs articles, tutorials, and guides.",
139140
url: pageUrl,
140141
isPartOf: {
141-
"@type": "WebSite",
142-
name: SITE_NAME,
143-
url: absoluteUrl("/"),
142+
"@id": SITE_WEBSITE_ID,
144143
},
145144
},
146145
buildBreadcrumbSchema([

app/team/[author]/page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
SITE_LOCALE,
1111
SITE_NAME,
1212
SITE_URL,
13+
SITE_WEBSITE_ID,
1314
absoluteUrl,
1415
buildBreadcrumbSchema,
1516
buildPublisherSchema,
@@ -288,9 +289,7 @@ export default async function Page({
288289
})),
289290
},
290291
isPartOf: {
291-
"@type": "WebSite",
292-
name: SITE_NAME,
293-
url: SITE_URL,
292+
"@id": SITE_WEBSITE_ID,
294293
},
295294
},
296295
buildBreadcrumbSchema([

app/team/page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
DEFAULT_TWITTER_IMAGE_PATH,
1111
SITE_LOCALE,
1212
SITE_NAME,
13+
SITE_WEBSITE_ID,
1314
absoluteUrl,
1415
buildBreadcrumbSchema,
1516
} from "@/lib/seo";
@@ -89,9 +90,7 @@ export default async function AuthorsPage() {
8990
description: "Meet the dedicated team behind L.A.P - Docs.",
9091
url: pageUrl,
9192
isPartOf: {
92-
"@type": "WebSite",
93-
name: SITE_NAME,
94-
url: absoluteUrl("/"),
93+
"@id": SITE_WEBSITE_ID,
9594
},
9695
},
9796
buildBreadcrumbSchema([

lib/seo.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const SITE_NAME = "L.A.P - Docs";
2-
export const SITE_ALTERNATE_NAMES = ["L.A.P Docs", "LAP Docs", "lap.onl"];
2+
export const SITE_ALTERNATE_NAMES = ["L.A.P Docs", "LAP Docs"];
33
export const SITE_URL = "https://lap.onl";
44
export const SITE_LOCALE = "en_US";
55
export const SITE_LANGUAGE = "en-US";
@@ -54,6 +54,7 @@ export function buildWebsiteSchema() {
5454
alternateName: SITE_ALTERNATE_NAMES,
5555
description: SITE_DESCRIPTION,
5656
inLanguage: SITE_LANGUAGE,
57+
publisher: { "@id": SITE_ORGANIZATION_ID },
5758
};
5859
}
5960

0 commit comments

Comments
 (0)