forked from THEOplayer/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsidebarsAdEngine.ts
More file actions
59 lines (51 loc) · 1.67 KB
/
sidebarsAdEngine.ts
File metadata and controls
59 lines (51 loc) · 1.67 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
import type { SidebarItem, SidebarItemCategory, SidebarItemConfig, SidebarItemDoc } from '@docusaurus/plugin-content-docs/lib/sidebars/types.d.ts';
import apiSidebar from './adengine/reference/sidebar';
function isCategory(item: SidebarItemConfig): item is SidebarItemCategory {
return (item as SidebarItem).type === 'category';
}
function isDoc(item: SidebarItemConfig): item is SidebarItemDoc {
return (item as SidebarItem).type === 'doc';
}
function cleanItems(data: SidebarItemConfig[]): SidebarItemConfig[] {
return data
.map((item) => {
// Remove the auto generated Introduction from the REST APIs
if (isDoc(item) && item.id === 'reference/dolby-optiview-ad-engine') {
return null;
}
// Rename the REST APIs title
if (isCategory(item) && item.label === 'Ad Engine') {
item.label = 'Ad Engine APIs';
item.collapsed = false;
}
if (isCategory(item) && item.label === 'Cloud Preview') {
item.label = 'Cloud Preview APIs';
item.collapsed = false;
}
return item;
})
.filter((item) => {
// Remove null items
return item !== null;
});
}
const sidebarItems: SidebarItemConfig[] = cleanItems(apiSidebar);
const sidebars: SidebarsConfig = {
adengine: [
'index',
{
type: 'category',
label: 'How-to guides',
description: 'How to use OptiView Ad Engine',
collapsed: false,
collapsible: false,
customProps: {
icon: '📖',
},
items: [{ type: 'autogenerated', dirName: 'how-to' }],
},
...sidebarItems,
],
};
export default sidebars;