From 08b7bd4f461f51191d5fd4d5aad5252d630781ec Mon Sep 17 00:00:00 2001 From: fallenbagel <98979876+fallenbagel@users.noreply.github.com> Date: Sat, 16 May 2026 18:12:49 +0800 Subject: [PATCH] refactor(docs): move REST API docs to navbar and dedicated sidebar (#3040) --- .github/workflows/docs-deploy.yml | 2 +- .github/workflows/test-docs.yml | 2 +- docs/api/_category_.json | 9 --------- gen-docs/docusaurus.config.ts | 22 ++++++++++++++++++++++ gen-docs/sidebars.ts | 3 +++ 5 files changed, 27 insertions(+), 11 deletions(-) delete mode 100644 docs/api/_category_.json diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index ddce5bf44..299c3600d 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -58,7 +58,7 @@ jobs: - name: Build website working-directory: gen-docs - run: pnpm gen-api-docs all && pnpm build + run: pnpm gen-api-docs && pnpm build - name: Upload Build Artifact uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b6 # v4.0.0 diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml index e8543067f..00625bf24 100644 --- a/.github/workflows/test-docs.yml +++ b/.github/workflows/test-docs.yml @@ -59,4 +59,4 @@ jobs: - name: Build website run: | cd gen-docs - pnpm build + pnpm gen-api-docs && pnpm build diff --git a/docs/api/_category_.json b/docs/api/_category_.json deleted file mode 100644 index 7543e6831..000000000 --- a/docs/api/_category_.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "label": "REST API documentation", - "position": 4, - "link": { - "type": "generated-index", - "title": "REST API documentation", - "description": "Create integrations with the Seerr REST API." - } -} diff --git a/gen-docs/docusaurus.config.ts b/gen-docs/docusaurus.config.ts index a01d95d3c..d2a6c0715 100644 --- a/gen-docs/docusaurus.config.ts +++ b/gen-docs/docusaurus.config.ts @@ -45,6 +45,19 @@ const config: Config = { path: '../docs', editUrl: 'https://github.com/seerr-team/seerr/edit/develop/docs/', docItemComponent: '@theme/ApiItem', + async sidebarItemsGenerator({ + defaultSidebarItemsGenerator, + ...args + }) { + const items = await defaultSidebarItemsGenerator(args); + return items.filter( + (item) => + !( + item.type === 'category' && + item.label?.toLowerCase() === 'api' + ) + ); + }, }, pages: false, theme: { @@ -103,6 +116,11 @@ const config: Config = { src: 'img/logo_full.svg', }, items: [ + { + to: '/api/seerr-api', + label: 'REST API', + position: 'right', + }, { to: 'blog', label: 'Blog', @@ -130,6 +148,10 @@ const config: Config = { label: 'Documentation', to: '/', }, + { + label: 'REST API', + to: '/api/seerr-api', + }, ], }, { diff --git a/gen-docs/sidebars.ts b/gen-docs/sidebars.ts index bad106a1f..9e08e5f08 100644 --- a/gen-docs/sidebars.ts +++ b/gen-docs/sidebars.ts @@ -1,4 +1,6 @@ import type { SidebarsConfig } from '@docusaurus/plugin-content-docs'; +// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths +import apiSidebar from '../docs/api/sidebar'; /** * Creating a sidebar enables you to: @@ -13,6 +15,7 @@ import type { SidebarsConfig } from '@docusaurus/plugin-content-docs'; const sidebars: SidebarsConfig = { // By default, Docusaurus generates a sidebar from the docs folder structure documentationSidebar: [{ type: 'autogenerated', dirName: '.' }], + apisidebar: apiSidebar, // But you can create a sidebar manually /*