skip to Main Content

I’m trying to create a different layout for each route groups, there’s 3 layouts: auth, dashboard, and public. But when I group the routes, the error "Non matching path () provided for /(public)" occured. Here’s my folder structure:

Folder Structure

Is there something wrong with the structure? Or is there something i missed?

2

Answers


  1. Check out this docs – https://nextjs.org/docs/app/building-your-application/routing/colocation

    In case your (public) group does not have any sub pages. Move the children out of the (public) folder, else move page.tsx inside a folder representing the route.

    Login or Signup to reply.
  2. As far as my understanding and according to the documents, the folder (public ) is only for grouping and won’t be consider a path, in order to make the route accessible you need to put the page.js inside another folder eg: (public)/public/page.js This will make it accessible by /public route.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search