diff --git a/package.json b/package.json index 6f6010fa..2ad68b72 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,6 @@ "shiki": "^3.2.1", "strip-markdown": "^6.0.0", "unified": "^11.0.5", - "unist-util-visit": "^5.0.0", "vfile-matter": "^5.0.1" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 04b040c3..bebb6f0e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -123,9 +123,6 @@ importers: unified: specifier: ^11.0.5 version: 11.0.5 - unist-util-visit: - specifier: ^5.0.0 - version: 5.0.0 vfile-matter: specifier: ^5.0.1 version: 5.0.1 diff --git a/src/components/docs-layout.jsx b/src/components/docs-layout.jsx index 48fec74b..bd55d506 100644 --- a/src/components/docs-layout.jsx +++ b/src/components/docs-layout.jsx @@ -39,16 +39,18 @@ export default function DocumentPage({ }) { const flatRoutes = flattenRoutes(routes); const { - asPath, query: { slug = [] }, } = useRouter(); + // Build the canonical path from slug + const canonicalUrl = ["/docs", ...slug].join("/") + "/"; + return ( <> matter(file); } -export function addTocToVFile() { - return (tree, file) => { - const toc = []; - visit(tree, "element", (node) => { - if ( - (node.tagName === "h2" || node.tagName === "h3") && - node.children[0].value - ) { - const title = node.children[0]?.value; - - toc.push({ - id: node.properties.id, - text: title, - level: Number.parseInt(node.tagName[1], 10), - }); - } - }); - - file.data.toc = toc; - }; -} - /** * Returns the parsed content of a document from its markdown content. * diff --git a/src/pages/docs/[[...slug]].jsx b/src/pages/docs/[[...slug]].jsx index 21fd2bf7..97cea921 100644 --- a/src/pages/docs/[[...slug]].jsx +++ b/src/pages/docs/[[...slug]].jsx @@ -16,7 +16,7 @@ export async function getStaticProps({ params }) { source, docsNavData, }, - revalidate: 1, + revalidate: 600, }; } catch (error) { if (error.notFound) {