How to add your pages to your routes.json file | PlayerLands

Wed Oct 06 2021

1 min read

How to configure your routes file

Please not that the custom template editor are designed for users who are familiar with html/css.

In order for you to navigate around your custom template, you will need to add each page you make into the routes.json file.

Below is an example from our Arvak Orange template routes.json file.

[{
"path":"/","template":"store-page.njk"
}, {
"path":"/category","template":"category-page.njk"
}, {
"path":"/product/:productId","template":"product-page.njk"
}, {
"path":"/checkout","template":"checkout-page.njk"
}, {
"path":"/payment-failure","template":"payment-failure-page.njk"
}, {
"path":"/payment-success","template":"payment-success-page.njk"
}]

As you can see we have to two parameters:

  1. path - This will be where the page will sit at the URL. Our first path in the above example points to "/".
  2. template This is what template file we want the path to load when you arrive that that url, for example the path pointing to "/" will load the store-page.njk file which is the home page for this template.

Make sure when you are configuring your routes.json file you follow the correct syntax format, if not your template will fail to load. Refer back to our example above to make sure your syntax follows.

That's it! Please take a look at our other knowledge base articles to help you start monetizing your server - Knowledge base.

Thanks for reading!

Tags

store, template, routes, custom, html, css