Adding templates and partials
To show the home template in the app, we need to open index.html
, which we created earlier, and perform the following steps:
- We replace
Hello World
with the following template inclusion helper:{{> layout}}
- If we go back to our browser now, we see that the text is gone and the
layout
template, which we created earlier, has appeared with its header and menu. - To complete the page, we need to show the
home
template in thelayout
template. We do this by simply adding another template inclusion helper to themain
section of thelayout
template in ourlayout.html
file, as follows:<main> {{> home}} </main>
- If we go back to the browser, we should see the following screenshot:
If we would now switch {{> home}}
for {{> about}}
, we would see our about
template instead.