Please, can someone explain to me how does router.js work ?

Can someone explain to me with a concrete example how does router.js work?
Unfortunely I read and read the API router informations, but I didn’t get it.
I would like read some different examples.

I would simply get this: when you click on menu ‘Who we are’, you are routed on a different page based on some properties of the User logged.

Example if the User is older than 18, you go to page Car, other way, on page Bicycle.

Is correct the use I would to do ?

Thanks in advance

1 Like

Up

1 Like

Up

1 Like

Hi Mauro,

routers.js is used for dynamic pages or sitemap. More on that here: https://www.wix.com/code/home/dynamic-pages.

However, in your case, it sounds like you want to use the wix-users API (Page Not Found - Velo API Reference - Wix.com). using this API, you can extract information on the current logged in user.

To route the user according to the extracted information, you can change the button’s link: Button - Velo API Reference - Wix.com.

Good luck,
Idan.