Next-routes: Named index route issues

Created on 27 Jul 2017  路  2Comments  路  Source: fridays/next-routes

How do you make a named route for the homepage?

I have tried:

routes.add('home', '/')

But that results in Client pings, but there's no entry for page: /home.

In some situations you want a index route with the name the same as an existing page file.

// When pages/sellers.js exists
routes.add('sellers', '/')

It automatically renders pages/sellers.js instead of pages/index.js.

Are these bugs? Is there a way to use all the parameters somehow to workaround the issues?

Most helpful comment

If no page is given as the third argument, it uses the name from the first argument as the page to render. So if you name it index, it will render that page. If you use a different name and it should render index, do this:

routes.add('sellers', '/', 'index')

All 2 comments

If no page is given as the third argument, it uses the name from the first argument as the page to render. So if you name it index, it will render that page. If you use a different name and it should render index, do this:

routes.add('sellers', '/', 'index')

Thanks, your tip worked.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

breeny picture breeny  路  5Comments

JiiB picture JiiB  路  4Comments

haotangio picture haotangio  路  5Comments

yves-s picture yves-s  路  4Comments

nishtacular picture nishtacular  路  3Comments