facebook / facebook/docusaurus

Allow manual sidebars to automatically pick up category indexes

オープン
#8,557 コメント 5 件 リアクション 1 件 担当者 0 名 GitHub で見る
feature
主要言語
TypeScript
スター
66.2k
フォーク
10k
平均マージ
1日 3時間
マージ済み PR(30日)
52

説明

### Have you read the Contributing Guidelines on issues?

- [X] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#reporting-new-issues).

### Prerequisites

- [X] I'm using the latest version of Docusaurus.
- [X] I have tried the `npm run clear` or `yarn clear` command.
- [X] I have tried `rm -rf node_modules yarn.lock package-lock.json` and re-installing packages.
- [X] I have tried creating a repro with https://new.docusaurus.io.
- [X] I have read the console error message carefully (if applicable).

### Description

I've run into an issue with `index` markdown files and manually managed sidebars.

Expected:

given sidebars.js
```js
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
controllerFirmwareSidebar: [
'index',
{
Configuration: [
'Configuration/index',
],
},
],
};
```

Clicking on "Configuration" in the sidebar should automatically show the content of the index file like illustrated in [the official documentation.](https://docusaurus.io/docs/sidebar/autogenerated#category-index-convention)
This works as expected for the top level.

Am I missing something obvious?
Perhaps the documentation is just unclear on how to work with the index files in a manual sidebar context.
From what I can tell, Docusaurus' documentation uses manual sidebars and has no problems following the index.mdx convention.

### Reproducible demo

_No response_

### Steps to reproduce

1. Create a starter docusaurus with the standard steps as seen in the official documentation.
2. Set up a file an folder structure that follows the sidebar config shown above.
3. Click on the `Configuration` in the sidebar.

### Expected behavior

Immediately show the index.mdx content.

### Actual behavior

Expands category and shows `index` in sidebar.

### Your environment

_No response_

### Self-service

- [X] I'd be willing to fix this bug myself.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。