Skip to content

Commit d9eca0c

Browse files
Fix indexing bug (#1232)
* This weeks newsletter * Enhance metadata and sitemap configuration - Updated layout metadata to include title, description, and Open Graph properties for better SEO. - Added '/api/og' to the robots.txt file to allow crawling. - Refactored sitemap generation to filter out '/api/og' routes and renamed variable for clarity.
1 parent 5061d17 commit d9eca0c

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

app/layout.tsx

+15-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,21 @@ export const metadata = {
4646
],
4747
metadataBase: new URL("https://www.codu.co"),
4848
openGraph: {
49-
images: "/images/og/home-og.png",
49+
title: "Codú - The Web Developer Community",
50+
description:
51+
"A free network and community for web developers. Learn and grow together.",
52+
url: "https://www.codu.co",
53+
siteName: "Codú",
54+
images: [
55+
{
56+
url: "https://www.codu.co/images/og/home-og.png",
57+
width: 1200,
58+
height: 630,
59+
alt: "Codú Community",
60+
},
61+
],
62+
locale: "en_US",
63+
type: "website",
5064
},
5165
};
5266

app/robots.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export default function robots(): MetadataRoute.Robots {
1515
"/notifications/",
1616
"/create/",
1717
"/my-posts/",
18-
"/hub/", // This should be crawled when completed
18+
"/hub/",
19+
"/api/og",
1920
],
2021
},
2122
sitemap: "https://www.codu.co/sitemap.xml",

app/sitemap.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,22 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
3838
}));
3939

4040
// Shape and connect all the data
41-
const data = [
41+
const allRoutes = [
4242
{
4343
url: BASE_URL,
4444
lastModified: new Date(),
4545
},
4646
...routes,
4747
...articles,
4848
...users,
49-
];
49+
].filter((route) => !route.url.includes("/api/og")); // Filter out OG routes
5050

5151
// Capture data as sitemap has been inconsistent and want to test on dev
5252
Sentry.captureMessage(
53-
`${JSON.stringify(data)}; Routes Count = ${
53+
`${JSON.stringify(allRoutes)}; Routes Count = ${
5454
routes.length
5555
}, Articles Count = ${articles.length}, Users Count = ${users.length}`,
5656
);
5757

58-
return data;
58+
return allRoutes;
5959
}

0 commit comments

Comments
 (0)