Duplicate navigation when using "includes" with Jade/Node
Problem
I have a one page website that I would like to keep but I also need individual sections to be viewed as independent pages. I'm using Jade with Node and everything is working fine until I start including files/blocks.
base.jade
!!! 5
head
body
.nav
// menu
block content
index.jade
extends layout/base
block content
p
| This is the index page.
include about
about.jade
extends layout/base
block content
p
| This is the about page.
What I'm trying to do is use the index page to display all of my pages and then have the individual pages extend the base.jade
file. What's happening is I'm getting multiple navigation bars on index.jade
because I'm extending base.jade
twice. I'm a little stuck and feel like I'm missing something simple here.
Any help is appreciated, thank you.
Related Articles
Solution
the file you include should only have the content portion such as
about-content.jade
p
| This is the something about the site.
then index.jade is
extends layout/base
block content
p
| This is the index page.
include about-content
and about.jade
extends layout/base
block content
p
| This is the about page.
include about-content
Discussion
View additional discussion.