Closed moklick closed 1 month ago
Hi Moritz, first of all, thank you for sponsoring 🙏
In v3 it was a fix of a bug, as I described in https://github.com/shuding/nextra/issues/2723#issuecomment-1954158161 page items in _meta
file which have display: "hidden"
will not have sidebar or TOC, because they are hidden from navigation, like mode draft.
Also, with this change in v4 there will be an improvement for bundle size since pageMap
will be rendered on the server, so the client bundle will be less (since pageMap
array will not contain hidden
pages)
What's your desired behaviour, to hide them only from sidebar navigation and mobile navigation? but keep working "theme"
property in _meta
file?
Hey @dimaMachina , thanks for your help here!
We are using display hidden for the pro section, because we don't want to show that page in the navbar: https://github.com/xyflow/web/blob/main/sites/reactflow.dev/src/pages/_meta.json#L56-L62
That pro page has a _meta (https://github.com/xyflow/web/blob/main/sites/reactflow.dev/src/pages/pro/_meta.json#L2-L7) that works for that page but not for the sub pages like /pro/examples. On that page we are not able to hide the TOC anymore.
But now that I understand the issue better, there might be a better way to hide the menu item instead of using display hidden 🤔 we could also filter that item in our custom nav bar component for example.
Thanks for the explanation, so to summarize setting display: "hidden"
should hide a page from the sidebar and mobile menu but keep working "theme"
property in _meta
file?
Yep, I would expect that theme
would still work even if the page or a parent page has display: 'hidden'
. Maybe another prop like exclude
, omit
or even excludeFromPageMap
would make it more clear.
I fixed this inconsistency, there is no need to introduce a new API, will be available in next release
@moklick available in https://github.com/shuding/nextra/releases/tag/nextra-theme-docs%403.0.4
feel free to create other issues with problems you encountered while migrating to v3!
Thanks a lot @dimaMachina ! I can confirm that it now works as expected and as before :)
While migrating to Nextra3 (thanks for your great work here btw 🙏), we encountered a bug with hiding the TOC. If you hide a page (
display: 'hidden'
via _meta.ts), you can't adjust parts of the theme in the subfolders. In our case we can't hide the TOC anymore.If you have a structure like this:
There is no way to disable the TOC for page2.1 and page2.2. We haven't changed anything about the content of the _meta files (besides adding
export default
..).To Reproduce Steps to reproduce the behavior:
display: 'hidden'
'*': { theme: { toc: false } }
Expected behavior:
_meta config should be respected for all pages.
Desktop: