I am trying to link to a doc directly in the sidebar per the v2 documentation.
(Write your steps here:)
sidebars.js codemodule.exports = {
docs: [
{
type: "category",
label: "Get Started",
items: ["get_started"]
},
{
type: "doc",
id: "api"
}
]
};
npm run startNo compile errors, we see the link directly to the doc in the sidebar.
It will not compile, see this error in console:
Error: Unknown sidebar item keys: id. Item: {"type":"doc","id":"api"}
You can't do that.
First level of a sidebar name docs must be category
// sidebars.js
module.exports = {
docs: [
{
type: 'category',
label: 'Getting Started',
items: ['greeting'],
},
{
type: 'category',
label: 'Docusaurus',
items: ['doc1'],
},
],
};
We should update the docs or at least do better in the error handling i guess
Oh OK, thanks for clarifying!
Thank you. We'll warn it to user better in #1994
Appreciate the quick follow up 馃帀
I actually disagree with this behavior. Why can't a category be a page? A side effect of this is that parent URLs don't work. Ex: /docs/category/child, the URL /docs/category returns a 404.
Related general URL issues: https://github.com/facebook/docusaurus/issues/1941 and https://github.com/facebook/docusaurus/issues/1973
Most helpful comment
See https://github.com/facebook/docusaurus/pull/2032