Sometimes the pages/
directory structure doesn't meet your needs, so you'll need to customize your routes manually. Using the nuxt config and "hidden pages" you can map routes to view components without getting in the way of the default pages routing.
[00:00] A hidden page is a page that you create that starts with an underscore, we'll call this user view that had a template in there with the div of H1 saying, "Find me." If I try and navigate to this _user, we'll get our 404, or just user I'll get that same 404.
[00:21] You can use these hidden pages to route to in your next config. In my config I'll configure the router which is an object which has routes inside of it. This is an array. This array has objects with that path. The path can just be /user, and then a component to map to.
[00:44] Our component will be pages/_user. Now I'm going to hit Save, and I refresh on my user URL. We can find and display the user view hidden page at this user URL, because we configured our router to have a route with the path of user and a component of _user.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!