Skip to content

Commit f4835bd

Browse files
committed
Fix SEO indexing and dependency alerts
1 parent 452b148 commit f4835bd

9 files changed

Lines changed: 2146 additions & 1194 deletions

File tree

app/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
DEFAULT_OG_IMAGE_PATH,
1212
DEFAULT_TWITTER_IMAGE_PATH,
1313
SITE_DESCRIPTION,
14+
SITE_HOME_URL,
1415
SITE_LOCALE,
1516
SITE_NAME,
1617
SITE_URL,
@@ -77,7 +78,7 @@ export const metadata: Metadata = {
7778
openGraph: {
7879
title: SITE_NAME,
7980
description: SITE_DESCRIPTION,
80-
url: SITE_URL,
81+
url: SITE_HOME_URL,
8182
siteName: SITE_NAME,
8283
locale: SITE_LOCALE,
8384
type: "website",

app/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import {
1313
DEFAULT_OG_IMAGE_PATH,
1414
DEFAULT_TWITTER_IMAGE_PATH,
1515
SITE_DESCRIPTION,
16+
SITE_HOME_URL,
1617
SITE_LOCALE,
1718
SITE_NAME,
18-
SITE_URL,
1919
} from "@/lib/seo";
2020

2121
export const metadata: Metadata = {
@@ -24,7 +24,7 @@ export const metadata: Metadata = {
2424
openGraph: {
2525
title: SITE_NAME,
2626
description: SITE_DESCRIPTION,
27-
url: SITE_URL,
27+
url: SITE_HOME_URL,
2828
siteName: SITE_NAME,
2929
type: "website",
3030
locale: SITE_LOCALE,
@@ -44,7 +44,7 @@ export const metadata: Metadata = {
4444
images: [DEFAULT_TWITTER_IMAGE_PATH],
4545
},
4646
alternates: {
47-
canonical: SITE_URL,
47+
canonical: SITE_HOME_URL,
4848
},
4949
};
5050

@@ -126,10 +126,10 @@ export default async function Home() {
126126
<PageTitle
127127
className="sr-only"
128128
imgSrc="/images/titles/lap-docs.svg"
129+
imgAlt={SITE_NAME}
129130
imageWidth={1520}
130131
imageHeight={216}
131132
priority
132-
decorative
133133
>
134134
L.A.P - Docs
135135
</PageTitle>

components/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export default function Footer() {
8686
</div>
8787
<div className="flex flex-col md:flex-row items-center md:items-start gap-4 text-gray-400 md:text-white font-regular text-sm md:order-1">
8888
<p>
89-
Copyright © {new Date().getFullYear()} L.A.P. All rights reserved.
89+
Copyright (c) {new Date().getFullYear()} {SITE_NAME}. All rights reserved.
9090
</p>
9191
</div>
9292
</div>

components/JsonLd.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
import React from "react";
22

3+
function serializeJsonLd(data: unknown) {
4+
return JSON.stringify(data)
5+
.replace(/</g, "\\u003c")
6+
.replace(/>/g, "\\u003e")
7+
.replace(/&/g, "\\u0026")
8+
.replace(/\u2028/g, "\\u2028")
9+
.replace(/\u2029/g, "\\u2029");
10+
}
11+
312
const JsonLd = ({ data }: { data: unknown }) => {
413
return (
514
<script
615
type="application/ld+json"
7-
dangerouslySetInnerHTML={{ __html: JSON.stringify(data) }}
16+
dangerouslySetInnerHTML={{ __html: serializeJsonLd(data) }}
817
/>
918
);
1019
};

components/Sidebar.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import PopularArticles from "./PopularArticles";
44
import { Button } from "./ui/button";
55
import magazineCover from "@/public/logos/LAP-Logo-Color.png";
66
import { db } from "@/lib/firebase";
7+
import { SITE_NAME } from "@/lib/seo";
78
import {
89
collection,
910
getDocs,
@@ -76,11 +77,11 @@ export default async function Sidebar() {
7677
return (
7778
<aside>
7879
<h3 className="uppercase font-semibold mb-2">Subscribe To</h3>
79-
<p className="text-4xl font-semibold">L.A.P - Tutorials</p>
80+
<p className="text-4xl font-semibold">{SITE_NAME}</p>
8081
<Image
8182
className="w-[20rem] pt-8 pb-4"
8283
src={magazineCover}
83-
alt="A cool and simple logo of L.A.P - Tutorials"
84+
alt={`${SITE_NAME} logo`}
8485
/>
8586
<Button
8687
asChild

lib/seo.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export const SITE_NAME = "L.A.P - Docs";
22
export const SITE_ALTERNATE_NAMES = ["L.A.P Docs", "LAP Docs"];
33
export const SITE_URL = "https://lap.onl";
4+
export const SITE_HOME_URL = `${SITE_URL}/`;
45
export const SITE_HOST = new URL(SITE_URL).host;
56
export const SITE_LOCALE = "en_US";
67
export const SITE_LANGUAGE = "en-US";
@@ -64,7 +65,7 @@ export function buildWebsiteSchema() {
6465
"@context": "https://schema.org",
6566
"@type": "WebSite",
6667
"@id": SITE_WEBSITE_ID,
67-
url: SITE_URL,
68+
url: SITE_HOME_URL,
6869
name: SITE_NAME,
6970
alternateName: SITE_ALTERNATE_NAMES,
7071
description: SITE_DESCRIPTION,
@@ -80,7 +81,7 @@ export function buildOrganizationSchema() {
8081
"@id": SITE_ORGANIZATION_ID,
8182
name: SITE_NAME,
8283
alternateName: SITE_ALTERNATE_NAMES,
83-
url: SITE_URL,
84+
url: SITE_HOME_URL,
8485
logo: {
8586
"@type": "ImageObject",
8687
url: absoluteUrl(SITE_LOGO_PATH),

netlify.toml

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,55 @@
33
publish = ".next"
44

55
[[plugins]]
6-
package = "@netlify/plugin-nextjs"
6+
package = "@netlify/plugin-nextjs"
7+
8+
[[redirects]]
9+
from = "https://www.lap.onl/*"
10+
to = "https://lap.onl/:splat"
11+
status = 301
12+
force = true
13+
14+
[[redirects]]
15+
from = "/magazine"
16+
to = "/posts"
17+
status = 301
18+
19+
[[redirects]]
20+
from = "/magazine/*"
21+
to = "/posts/:splat"
22+
status = 301
23+
24+
[[redirects]]
25+
from = "/articles"
26+
to = "/posts"
27+
status = 301
28+
29+
[[redirects]]
30+
from = "/articles/*"
31+
to = "/posts/:splat"
32+
status = 301
33+
34+
[[redirects]]
35+
from = "/article/*"
36+
to = "/posts/:splat"
37+
status = 301
38+
39+
[[redirects]]
40+
from = "/authors"
41+
to = "/team"
42+
status = 301
43+
44+
[[redirects]]
45+
from = "/authors/*"
46+
to = "/team/:splat"
47+
status = 301
48+
49+
[[redirects]]
50+
from = "/category/*"
51+
to = "/topics/:splat"
52+
status = 301
53+
54+
[[redirects]]
55+
from = "/categories/*"
56+
to = "/topics/:splat"
57+
status = 301

0 commit comments

Comments
 (0)