diff --git a/scripts/generate-docs-index.ts b/scripts/generate-docs-index.ts index 9b62b07..d954608 100644 --- a/scripts/generate-docs-index.ts +++ b/scripts/generate-docs-index.ts @@ -77,6 +77,7 @@ async function walkDocs(dir: string, base = ''): Promise { const content = await fs.readFile(path.join(dir, entry.name), 'utf8'); const frontmatter = parseFrontmatter(content); + if (frontmatter.draft === 'true') continue; const slug = filePathToSlug(rel); pages.push({ diff --git a/src/pages/[...path]/index.md.ts b/src/pages/[...path]/index.md.ts index 53cac1f..1bb140a 100644 --- a/src/pages/[...path]/index.md.ts +++ b/src/pages/[...path]/index.md.ts @@ -10,7 +10,7 @@ import { mdxToMarkdown } from "../../lib/mdx-to-markdown"; const BASE_URL = "https://bomb.sh/docs"; export async function getStaticPaths() { - const docs = await getCollection("docs"); + const docs = await getCollection("docs", ({ data }) => import.meta.env.DEV || !data.draft); return docs .filter((doc) => doc.id !== "index" && doc.id !== "404") .map((doc) => ({ params: { path: doc.id }, props: { doc } })); diff --git a/src/pages/index.md.ts b/src/pages/index.md.ts index 8e32e71..2ff4239 100644 --- a/src/pages/index.md.ts +++ b/src/pages/index.md.ts @@ -16,7 +16,7 @@ const SECTION_LABELS: Record = { }; export const GET: APIRoute = async () => { - const docs = await getCollection("docs"); + const docs = await getCollection("docs", ({ data }) => import.meta.env.DEV || !data.draft); const sections = new Map(); for (const doc of docs) {