Fixed side menu on an specific route #14103
Unanswered
matiastucci
asked this question in
Help
Replies: 1 comment
-
Will this help? #12325 (comment) Essentially, you get which page you are on currently and then compare the routes to hide/show top nav/sidebar. If you want only site.com/posts/* to show the sidebar and everything else to show top nav, use regex to compare if asPath starts with /posts and hide top nav and show sidebar. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
👋 I'm starting a new project and I would like to always have a top nav and only in a specific route have a sidebar where I can click and the content will change.
I'm having trouble with the second and third bullet. My pages path is
pages/posts/index.js
andpages/posts/[id].js
but how can I declare only one file and avoid duplicating code? 🤔I tried
pages/posts/[[...slug]].js
but I'm seeing this error:Error: Optional catch-all routes are currently experimental and cannot be used by default ("/posts/[[...slug]]")
I'm looking for examples but so far I couldn't do it.
Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions