Skip to content

Commit 08b7bd4

Browse files
authored
refactor(docs): move REST API docs to navbar and dedicated sidebar (#3040)
1 parent a0418d1 commit 08b7bd4

5 files changed

Lines changed: 27 additions & 11 deletions

File tree

.github/workflows/docs-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
5959
- name: Build website
6060
working-directory: gen-docs
61-
run: pnpm gen-api-docs all && pnpm build
61+
run: pnpm gen-api-docs && pnpm build
6262

6363
- name: Upload Build Artifact
6464
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b6 # v4.0.0

.github/workflows/test-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ jobs:
5959
- name: Build website
6060
run: |
6161
cd gen-docs
62-
pnpm build
62+
pnpm gen-api-docs && pnpm build

docs/api/_category_.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

gen-docs/docusaurus.config.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ const config: Config = {
4545
path: '../docs',
4646
editUrl: 'https://github.com/seerr-team/seerr/edit/develop/docs/',
4747
docItemComponent: '@theme/ApiItem',
48+
async sidebarItemsGenerator({
49+
defaultSidebarItemsGenerator,
50+
...args
51+
}) {
52+
const items = await defaultSidebarItemsGenerator(args);
53+
return items.filter(
54+
(item) =>
55+
!(
56+
item.type === 'category' &&
57+
item.label?.toLowerCase() === 'api'
58+
)
59+
);
60+
},
4861
},
4962
pages: false,
5063
theme: {
@@ -103,6 +116,11 @@ const config: Config = {
103116
src: 'img/logo_full.svg',
104117
},
105118
items: [
119+
{
120+
to: '/api/seerr-api',
121+
label: 'REST API',
122+
position: 'right',
123+
},
106124
{
107125
to: 'blog',
108126
label: 'Blog',
@@ -130,6 +148,10 @@ const config: Config = {
130148
label: 'Documentation',
131149
to: '/',
132150
},
151+
{
152+
label: 'REST API',
153+
to: '/api/seerr-api',
154+
},
133155
],
134156
},
135157
{

gen-docs/sidebars.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
2+
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
3+
import apiSidebar from '../docs/api/sidebar';
24

35
/**
46
* Creating a sidebar enables you to:
@@ -13,6 +15,7 @@ import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
1315
const sidebars: SidebarsConfig = {
1416
// By default, Docusaurus generates a sidebar from the docs folder structure
1517
documentationSidebar: [{ type: 'autogenerated', dirName: '.' }],
18+
apisidebar: apiSidebar,
1619

1720
// But you can create a sidebar manually
1821
/*

0 commit comments

Comments
 (0)