Reputation: 14824
I've made a header file that I would like to include in all my pages, it also includes the navbar and has the body in it to in a nutshell it is like this
!!!
html
head
title
body
I would like to be able to include it in any other file, and be able to continue to write inside the body, if I try to include it now, anything I write in the new file appears after the closing </html>
so how might I be able to do this? Thanks.
Upvotes: 0
Views: 95
Reputation: 5788
Use block
, but think the other way. Create a base.jade, which contains the shared part, and extend this.
!!!
html
head
title
body
block main
p Hello
than in your other files:
extends base
block append body
p World
this will result in
<html>
<head>
<title></title>
</head>
<body>
<p>Hello</p>
<p>World</p>
</body>
</html>
Than there's a command include
, which is not what you want, but maybe worth mention.
!!!
html
head
include head.jade
body
block main
More info in the docs
Upvotes: 1