We have an index
file, which will probably have an about
file as well. We don't want to have a menu in both views and then in every other view we create. So what we can do is we can surround our views in a layout, and then in that layout we can provide the code that we want to be on every page.
So in the views
folder we'll create a new document and call this layout.pug
. Let's open that up, grab the code right from the Basics
window, and paste that into the layout.pug
file:
doctype html html head title my jade template body h1 Hello World
Let's save that!
Note
As mentioned before in the Back to basics section, the indents need to be either spaces or tabs. If these aren't formatted correctly you will get errors. I'm going to use spaces.
Now in the index
file, we need to specify that we want to use that layout. So what we'll do is at the top, we'll use extends layout
and then use block content
. We'll then use h3 Hello World
and this has to be inside block content
, so we'll put...