-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathapisidebar.js
More file actions
38 lines (32 loc) · 1.28 KB
/
apisidebar.js
File metadata and controls
38 lines (32 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// const paletteAPIVersions = [ // { // version: "1.0.0", // label: "V1", // baseUrl: "/api/introduction", // }, // ];
// const { // versionSelector, // versionCrumb, // } = require("docusaurus-plugin-openapi-docs/lib/sidebars/utils");
const fs = require("fs");
const sidebarFilePath = "./docs/api-content/api-docs/v1/sidebar.ts";
function loadSidebar(path) {
if (!fs.existsSync(path)) return [];
const mod = require(path);
// Handle both CommonJS and ESM-style exports
return Array.isArray(mod) ? mod : mod.default || [];
}
const sidebarItems = loadSidebar(sidebarFilePath);
const sidebarEmcFilePath = "./docs/api-content/api-docs/edge-v1/sidebar.ts";
const emcSidebarItems = loadSidebar(sidebarEmcFilePath);
module.exports = {
apiSidebar: [
{ type: "doc", id: "introduction", label: "Introduction" },
{ type: "doc", id: "samples", label: "Example Usage" },
{ type: "doc", id: "postman-collection", label: "Postman collection" },
{
type: "category",
label: "Palette API V1",
link: { type: "generated-index", title: "Palette API V1" },
items: sidebarItems,
},
{
type: "category",
label: "Edge Management API V1",
link: { type: "generated-index", title: "Edge Management API V1" },
items: emcSidebarItems,
},
],
};