Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3] Not working sidebar and toc #2935

Closed
Gellipapa opened this issue Jun 16, 2024 · 3 comments
Closed

[v3] Not working sidebar and toc #2935

Gellipapa opened this issue Jun 16, 2024 · 3 comments

Comments

@Gellipapa
Copy link

Hi! I am trying to use nextra docs v3.

//theme.config.tsx

  sidebar: {
    autoCollapse: true,
    defaultMenuCollapseLevel: 1,
    toggleButton: true
  },
  toc: {
    backToTop: true,
    float: true
  }

I have entered the new settings and for some reason neither the sidebar nor the toc appear.

What I also noticed is that in mobile view the toggle appears and the "menu" comes up but on the main page itself, not in mobile view, none of the sidebars appear.

  //_meta.ts
  
  export default {
  test: 'Test',
  'test-2': {
    type: 'page'
  }
}

I use plain _meta.ts, which you can see how it is built above.

What I also noticed is that I get two types of error. I don't know how much this affects it, because maybe it has to do with the hot reload and the build will eliminate these errors, but maybe I'm wrong.

image

image

Could you please help me with this and tell me what the problem might be?

Thank you in advance for your answers.

@amcdnl
Copy link

amcdnl commented Jun 17, 2024

I think this is related to my issue as well - #2920

@Gellipapa
Copy link
Author

Gellipapa commented Jun 21, 2024

@amcdnl Hi! Thanks for your answer. I tested dev mode, not production.

It's quite strange because in mobile view when I open the page there is sidebar, but there are some pages where I click and the sidebar doesn't appear and the main page itself doesn't have the sidebar.

I have tried the ones described in the issue, but I could not solve the problem.

I also turned off javascript in devtools and the HTML content that renders the sidebar doesn't appear anyway.

My guess is that I have 6 hydration errors and that's why it doesn't appear.

Do you think this could be a problem?

Thanks for answers.

Bye,

Gellipapa

@Gellipapa
Copy link
Author

Hi! I was able to solve the problem, the problem was that in _meta.ts type: 'page' was set so the sidebar and the toc don't appear, if it's not there it works fine.

//_meta.ts
export default {
  index: {
    title: 'Introduction',
    type: 'page' //you should remove this line if you want show sidebar and toc
  },
  test: {
    title: 'Test',
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants