docs: make API sidebar partially autogenerated (#5917)

* docs: make API sidebar autogenerated

* fix paths
This commit is contained in:
Joshua Chen 2021-11-10 14:08:50 +08:00 committed by GitHub
parent c541e2d83c
commit 4478dd9659
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 33 additions and 36 deletions

View file

@ -1,4 +1,5 @@
---
sidebar_position: 0
id: docusaurus.config.js
description: API reference for Docusaurus configuration file.
slug: /api/docusaurus-config

View file

@ -1,6 +1,8 @@
---
sidebar_position: 1
id: lifecycle-apis
title: Lifecycle APIs
slug: /lifecycle-apis
toc_max_heading_level: 4
---

View file

@ -0,0 +1,2 @@
label: Plugins
position: 2

View file

@ -1,4 +1,5 @@
---
sidebar_position: 0
id: plugins-overview
title: 'Docusaurus plugins'
sidebar_label: Plugins overview

View file

@ -1,4 +1,5 @@
---
sidebar_position: 4
id: plugin-client-redirects
title: '📦 plugin-client-redirects'
slug: '/api/plugins/@docusaurus/plugin-client-redirects'

View file

@ -1,4 +1,5 @@
---
sidebar_position: 2
id: plugin-content-blog
title: '📦 plugin-content-blog'
slug: '/api/plugins/@docusaurus/plugin-content-blog'

View file

@ -1,4 +1,5 @@
---
sidebar_position: 1
id: plugin-content-docs
title: '📦 plugin-content-docs'
slug: '/api/plugins/@docusaurus/plugin-content-docs'

View file

@ -1,4 +1,5 @@
---
sidebar_position: 3
id: plugin-content-pages
title: '📦 plugin-content-pages'
slug: '/api/plugins/@docusaurus/plugin-content-pages'

View file

@ -1,4 +1,5 @@
---
sidebar_position: 5
id: plugin-debug
title: '📦 plugin-debug'
slug: '/api/plugins/@docusaurus/plugin-debug'

View file

@ -1,4 +1,5 @@
---
sidebar_position: 6
id: plugin-google-analytics
title: '📦 plugin-google-analytics'
slug: '/api/plugins/@docusaurus/plugin-google-analytics'

View file

@ -1,4 +1,5 @@
---
sidebar_position: 7
id: plugin-google-gtag
title: '📦 plugin-google-gtag'
slug: '/api/plugins/@docusaurus/plugin-google-gtag'

View file

@ -1,4 +1,5 @@
---
sidebar_position: 8
id: plugin-ideal-image
title: '📦 plugin-ideal-image'
slug: '/api/plugins/@docusaurus/plugin-ideal-image'

View file

@ -1,4 +1,5 @@
---
sidebar_position: 9
id: plugin-pwa
title: '📦 plugin-pwa'
slug: '/api/plugins/@docusaurus/plugin-pwa'

View file

@ -1,4 +1,5 @@
---
sidebar_position: 10
id: plugin-sitemap
title: '📦 plugin-sitemap'
slug: '/api/plugins/@docusaurus/plugin-sitemap'

View file

@ -0,0 +1,2 @@
label: Themes
position: 3

View file

@ -1,4 +1,5 @@
---
sidebar_position: 0
id: themes-overview
title: 'Docusaurus themes'
sidebar_label: Themes overview

View file

@ -1,4 +1,5 @@
---
sidebar_position: 2
id: theme-classic
title: '📦 theme-classic'
slug: '/api/themes/@docusaurus/theme-classic'

View file

@ -1,4 +1,5 @@
---
sidebar_position: 1
id: theme-configuration
title: 'Theme configuration'
slug: '/api/themes/configuration'

View file

@ -1,4 +1,5 @@
---
sidebar_position: 3
id: theme-live-codeblock
title: '📦 theme-live-codeblock'
slug: '/api/themes/@docusaurus/theme-live-codeblock'

View file

@ -1,4 +1,5 @@
---
sidebar_position: 4
id: theme-search-algolia
title: '📦 theme-search-algolia'
slug: '/api/themes/@docusaurus/theme-search-algolia'

View file

@ -134,4 +134,4 @@ For themes that supports TypeScript theme components, you can add the `--typescr
npm run swizzle @docusaurus/theme-classic Footer -- --typescript
```
At this moment, the only official Docusaurus theme that supports TypeScript theme components is `@docusaurus/theme-classic`. If you are a Docusaurus theme package author who wants to add TypeScript support, see the [Lifecycle APIs docs](./lifecycle-apis.md#gettypescriptthemepath).
At this moment, the only official Docusaurus theme that supports TypeScript theme components is `@docusaurus/theme-classic`. If you are a Docusaurus theme package author who wants to add TypeScript support, see the [Lifecycle APIs docs](./api/lifecycle-apis.md#gettypescriptthemepath).

View file

@ -121,7 +121,7 @@ Docusaurus' implementation of the plugins system provides us with a convenient w
A plugin is a function that takes two parameters: `context` and `options`.
It returns a plugin instance object, containing plugin [lifecycle APIs](./lifecycle-apis.md).
It returns a plugin instance object, containing plugin [lifecycle APIs](./api/lifecycle-apis.md).
It can be defined as a function or a module.
@ -206,4 +206,4 @@ interface LoadContext {
#### Return value {#return-value}
The returned object value should implement the [lifecycle APIs](lifecycle-apis.md).
The returned object value should implement the [lifecycle APIs](./api/lifecycle-apis.md).

View file

@ -210,13 +210,13 @@ website
There are two lifecycle methods that are essential to theme implementation:
- [`getThemePath()`](lifecycle-apis.md#getthemepath)
- [`getClientModules()`](lifecycle-apis.md#getclientmodules)
- [`getThemePath()`](./api/lifecycle-apis.md#getthemepath)
- [`getClientModules()`](./api/lifecycle-apis.md#getclientmodules)
These lifecycle methods are not essential but recommended:
- [`validateThemeConfig({themeConfig, validate})`](lifecycle-apis.md#validatethemeconfigthemeconfig-validate)
- [`validateOptions({options, validate})`](lifecycle-apis.md#validateoptionsoptions-validate)
- [`validateThemeConfig({themeConfig, validate})`](./api/lifecycle-apis.md#validatethemeconfigthemeconfig-validate)
- [`validateOptions({options, validate})`](./api/lifecycle-apis.md#validateoptionsoptions-validate)
<!--
@ -231,7 +231,7 @@ Related pieces
---
- [Advanced Guides Themes](using-themes.md)
- [Lifecycle APIs](lifecycle-apis.md)
- [Lifecycle APIs](./api/lifecycle-apis.md)
References
---

View file

@ -109,35 +109,9 @@ const sidebars = {
api: [
'cli',
'docusaurus-core',
'api/docusaurus.config.js',
'lifecycle-apis',
{
type: 'category',
label: 'Plugins',
items: [
'api/plugins/plugins-overview',
'api/plugins/plugin-content-docs',
'api/plugins/plugin-content-blog',
'api/plugins/plugin-content-pages',
'api/plugins/plugin-client-redirects',
'api/plugins/plugin-debug',
'api/plugins/plugin-google-analytics',
'api/plugins/plugin-google-gtag',
'api/plugins/plugin-ideal-image',
'api/plugins/plugin-pwa',
'api/plugins/plugin-sitemap',
],
},
{
type: 'category',
label: 'Themes',
items: [
'api/themes/themes-overview',
'api/themes/theme-configuration',
'api/themes/theme-classic',
'api/themes/theme-live-codeblock',
'api/themes/theme-search-algolia',
],
type: 'autogenerated',
dirName: 'api',
},
],
};