Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat: Fix docs sitemap

Richie McIlroya8ab944f86bd
diff --git a/apps/web/app/sitemap.ts b/apps/web/app/sitemap.ts
index 6bbcca0b8..7654df4bb 100644
--- a/apps/web/app/sitemap.ts
+++ b/apps/web/app/sitemap.ts
@@ -1,6 +1,6 @@
import { promises as fs } from "fs";
import path from "path";
-import { getBlogPosts } from "@/utils/blog";
+import { getBlogPosts, getDocs } from "@/utils/blog";
import { seoPages } from "../lib/seo-pages";
async function getPagePaths(
@@ -14,7 +14,6 @@ async function getPagePaths(
if (
entry.isDirectory() &&
entry.name !== "dashboard" &&
- !entry.name.startsWith("s") &&
entry.name !== "blog" &&
!entry.name.startsWith("[")
) {
@@ -28,7 +27,6 @@ async function getPagePaths(
const routePath = "/" + relativePath.split(path.sep).slice(1).join("/");
if (
!routePath.includes("/dashboard") &&
- !routePath.split("/").some((segment) => segment.startsWith("s")) &&
!routePath.includes("[")
) {
const stats = await fs.stat(fullPath);
@@ -58,15 +56,21 @@ export default async function sitemap() {
};
});
+ // Add docs routes
+ const docs = getDocs();
+ const docsRoutes = docs.map((doc) => ({
+ path: `/docs/${doc.slug}`,
+ lastModified: new Date().toISOString(), // You might want to add a publishedAt to doc metadata
+ }));
+
// Add SEO pages
const seoRoutes = Object.keys(seoPages).map((slug) => ({
path: `/${slug}`,
- // Set lastModified to current date since these are static pages
lastModified: new Date().toISOString(),
}));
// Combine routes and ensure '/' is first
- const allRoutes = [...pagePaths, ...blogRoutes, ...seoRoutes];
+ const allRoutes = [...pagePaths, ...blogRoutes, ...docsRoutes, ...seoRoutes];
const homeRoute = allRoutes.find((route) => route.path === "/");
const otherRoutes = allRoutes.filter((route) => route.path !== "/");