refactor(docs): move REST API docs to navbar and dedicated sidebar (#3040)

This commit is contained in:
fallenbagel
2026-05-16 18:12:49 +08:00
committed by GitHub
parent a0418d1244
commit 08b7bd4f46
5 changed files with 27 additions and 11 deletions

View File

@@ -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

View File

@@ -59,4 +59,4 @@ jobs:
- name: Build website
run: |
cd gen-docs
pnpm build
pnpm gen-api-docs && pnpm build

View File

@@ -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."
}
}

View File

@@ -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',
},
],
},
{

View File

@@ -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
/*