The routes.yaml config you have seems to be correct. For it to work, first of all, you need to make sure you have a “page” with “home” slug published and available for public access. Second, you need to create a home.hbs template in your theme and place something like the following code to be able to use dynamic content on that page:
Note The indenting, yaml files are sensitive to the indentation of keys and values. That should provide the home page with the data from the page with “home” as the slug. The other part is to redirect “/home/” to the home page, which can be done with redirects.json:
I’m reiterating the solution so that for newcomers, it will be easy to figure out the two approaches to the solution.
Creating a Custom Home Page
Indentation is the key here if you have trouble try to copy-paste the routes and follow the steps correctly.
If you want to use the template styling, use the page editor to add content to the home page (you need to create a new home page first) that displays on your yourwebsite.com. Also, redirect the yourwebsite.com/home to yourwebsite.com. Here is the solution from @gargol and with correct indentation, it works just fine.
If you want to use a clean state without the header, footer and any styling but just the Title and Page Content to display from home page on yourwebsite.com. Here is the solution from @DavidDarnes and with correct indentation, it works fine.
routes.yaml - Configure it like mentioned here.
home.hbs - Add the template with content like this.
Wow awesome write up on how you made a custom home page! We may also be working on improved documentation for this very feature .
I think you can remedy this by using the canonical option in the page settings and link the page “/home” to the home page, “/” (if you put in slash it might change to the site url automatically). Hope this helps!
@DavidDarnes Overall this document is better than the previous. Except for the placement of the Snippet for HomePage don’t have any other feedback. It should have been referenced or placed when the first mention of creating home.hbs occurs in the document.
We can prevent that from happening by creating a new template in our theme called home.hbs .