Index pages cannot be generated with an automatically generated siderbar
cshsoft opened this issue · comments
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I'm using the latest version of Docusaurus.
- I have tried the
npm run clear
oryarn clear
command. - I have tried
rm -rf node_modules yarn.lock package-lock.json
and re-installing packages. - I have tried creating a repro with https://new.docusaurus.io.
- I have read the console error message carefully (if applicable).
Description
using property as docSidebar: [{type: 'autogenerated', dirName: 'xxx'}], index pages cannot be generated, it's report error :
is not associated with a category. useCurrentSidebarCategory() should only be used on category index pages. how do fixed it
Reproducible demo
No response
Steps to reproduce
1: set sidebars as autogenerated
2: add index.mdx in doc dir
Expected behavior
Automatically generate index pages based on category.json
Actual behavior
Index pages cannot be generated with an automatically generated siderbar
Your environment
- Public source code:
- Public site URL:
- Docusaurus version used:
- Environment name and version (e.g. Chrome 89, Node.js 16.4):
- Operating system and version (e.g. Ubuntu 20.04.2 LTS):
Self-service
- I'd be willing to fix this bug myself.
I'm sorry but we need a repro for this kind of bug report because steps are often not enough and ambiguous
https://stackblitz.com/edit/github-pmrjwx?file=docs%2Findex.mdx,sidebars.ts
Most likely this is a duplicate of this: #9923 (comment)