Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/components/docs-layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
<Seo
title={frontmatter?.title ?? "FALLBACK TITLE"}
description={frontmatter?.description}
url={asPath}
url={canonicalUrl}
/>
<Disclosure
as="div"
Expand Down
23 changes: 0 additions & 23 deletions src/lib/remark-parsing.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import withSmartQuotes from "remark-smartypants";
import remarkStringify from "remark-stringify";
import remarkStrip from "strip-markdown";
import { unified } from "unified";
import { visit } from "unist-util-visit";
import { matter } from "vfile-matter";
import { getRemoteImgUrl } from "./remote-mdx-files.mjs";
/**
Expand All @@ -36,28 +35,6 @@ function addFrontmatterToVFile() {
return (_, file) => 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.
*
Expand Down
2 changes: 1 addition & 1 deletion src/pages/docs/[[...slug]].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function getStaticProps({ params }) {
source,
docsNavData,
},
revalidate: 1,
revalidate: 600,
};
} catch (error) {
if (error.notFound) {
Expand Down