feat(v2): provide doc sidebar_label through sidebars.js (#4500)

* feat : update SidebarItemDoc type

* feat : update assertIsDoc

* feat : allow configuring title from sidebar.js

* feat : add docs

* docs : refactor i18n docs to use label in sidebar.js

* test : add test

* Update website/docs/guides/docs/sidebar.md

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>

* docs : remove backported docs

Co-authored-by: Lisa Chandra <52909743+lisa761@users.noreply.github.com>
Co-authored-by: Javid <singularity.javid@gmail.com>
Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
This commit is contained in:
besemuna 2021-03-26 14:11:21 +00:00 committed by GitHub
parent f7614081dd
commit 9715048f79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 111 additions and 11 deletions

View file

@ -128,6 +128,7 @@ type SidebarItemDoc =
| {
type: 'doc';
id: string;
label: string; // Sidebar label text
};
```
@ -137,10 +138,11 @@ Example:
{
type: 'doc',
id: 'doc1', // string - document id
label: 'Getting started' // Sidebar label text
}
```
Using just the [Document ID](#document-id) is also valid, the following is equivalent to the above:
The `sidebar_label` in the markdown frontmatter has a higher precedence over the `label` key in `SidebarItemDoc`. Using just the [Document ID](#document-id) is also valid, the following is equivalent to the above:
```js
'doc1'; // string - document id