Skip to content

Commit aaf8d20

Browse files
committed
fix(docs): use label-based API version mapping in docs-developers aztec-nr api page
Apply the equivalent of upstream fix 0e1c474 (PR #22617) to v4-next. On next, the fix targets the v4.2.0 versioned snapshot; on v4-next that snapshot does not exist yet, but docs-developers/docs/aztec-nr/api.mdx — the source that will seed the next versioned cut — still carries the stale name-based useApiVersion logic. Replacing it with the label-based mapping prevents the same regression recurring when v4.2.0 developer docs are cut from v4-next.
1 parent 9badce9 commit aaf8d20

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

  • docs/docs-developers/docs/aztec-nr

docs/docs-developers/docs/aztec-nr/api.mdx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ import { useActiveVersion } from "@docusaurus/plugin-content-docs/client";
1010

1111
export const useApiVersion = () => {
1212
const version = useActiveVersion("developer");
13-
const versionName = version?.name || "current";
14-
// Map Docusaurus version to API docs folder
15-
if (versionName === "current") return "next";
16-
if (versionName.includes("rc") || versionName.includes("testnet")) return "testnet";
17-
return versionName;
13+
if (!version || version.name === "current") return "next";
14+
// Map Docusaurus version to API docs folder using version label
15+
// Labels are set explicitly in docusaurus.config.js (e.g., "Mainnet (...)")
16+
const label = version.label || "";
17+
if (label.startsWith("Alpha")) return "mainnet";
18+
if (label.startsWith("Testnet")) return "testnet";
19+
return version.name;
1820
};
1921

2022
export const ModuleLink = ({ path, children }) => {

0 commit comments

Comments
 (0)