mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-26 01:33:02 +00:00
backport sidebar_key front matter docs to v3.9.2 docs
(see https://github.com/facebook/docusaurus/pull/11490/)
This commit is contained in:
parent
865365f0a2
commit
83f5ec9678
|
|
@ -282,6 +282,7 @@ Accepted fields:
|
|||
| `sidebar_label` | `string` | `title` | The text shown in the document sidebar for this document. |
|
||||
| `sidebar_position` | `number` | Default ordering | Controls the position of a doc inside the generated sidebar slice when using `autogenerated` sidebar items. See also [Autogenerated sidebar metadata](/docs/sidebar/autogenerated#autogenerated-sidebar-metadata). |
|
||||
| `sidebar_class_name` | `string` | `undefined` | Gives the corresponding sidebar label a special class name when using autogenerated sidebars. |
|
||||
| `sidebar_key` | `string` | `undefined` | Gives the corresponding sidebar item a key to uniquely identify the sidebar item. This is mostly useful for i18n sites to generate unique translation keys for categories sharing the same labels. An error will tell you when this extra metadata is needed. |
|
||||
| `sidebar_custom_props` | `object` | `undefined` | Assign [custom props](../../guides/docs/sidebar/index.mdx#passing-custom-props) to the sidebar item referencing this doc |
|
||||
| `displayed_sidebar` | `string` | `undefined` | Force the display of a given sidebar when browsing the current document. Read the [multiple sidebars guide](../../guides/docs/sidebar/multiple-sidebars.mdx) for details. |
|
||||
| `hide_title` | `boolean` | `false` | Whether to hide the title at the top of the doc. It only hides a title declared through the front matter, and have no effect on a Markdown title at the top of your document. |
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ For handwritten sidebar definitions, you would provide metadata to sidebar items
|
|||
|
||||
### Doc item metadata {#doc-item-metadata}
|
||||
|
||||
The `label`, `className`, and `customProps` attributes are declared in front matter as `sidebar_label`, `sidebar_class_name`, and `sidebar_custom_props`, respectively. Position can be specified in the same way, via `sidebar_position` front matter.
|
||||
The `label`, `className`, `key`, and `customProps` attributes are declared in front matter as `sidebar_label`, `sidebar_class_name`, `sidebar_key` and `sidebar_custom_props`, respectively. Position can be specified in the same way, via `sidebar_position` front matter.
|
||||
|
||||
```md title="docs/tutorials/tutorial-easy.md"
|
||||
---
|
||||
|
|
@ -318,6 +318,7 @@ The `label`, `className`, and `customProps` attributes are declared in front mat
|
|||
sidebar_position: 2
|
||||
sidebar_label: Easy
|
||||
sidebar_class_name: green
|
||||
sidebar_key: unique-sidebar-item-key
|
||||
# highlight-end
|
||||
---
|
||||
|
||||
|
|
@ -328,7 +329,7 @@ This is the easy tutorial!
|
|||
|
||||
### Category item metadata {#category-item-metadata}
|
||||
|
||||
Add a `_category_.json` or `_category_.yml` file in the respective folder. You can specify any category metadata and also the `position` metadata. `label`, `className`, `position`, and `customProps` will default to the respective values of the category's linked doc, if there is one.
|
||||
Add a `_category_.json` or `_category_.yml` file in the respective folder. You can specify any category metadata and also the `position` metadata. `label`, `className`, `key`, `position`, and `customProps` will default to the respective values of the category's linked doc, if there is one.
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="JSON">
|
||||
|
|
@ -337,6 +338,7 @@ Add a `_category_.json` or `_category_.yml` file in the respective folder. You c
|
|||
{
|
||||
"position": 2.5,
|
||||
"label": "Tutorial",
|
||||
"key": "unique-sidebar-item-key",
|
||||
"collapsible": true,
|
||||
"collapsed": false,
|
||||
"className": "red",
|
||||
|
|
|
|||
Loading…
Reference in New Issue