elju
elju

Reputation: 435

jade layouts failing to extend

I cannot get jade files to properly extend each other. Here is my index.jade file:

!!! 5
html(lang='en')
  head
   ... scripts and stuff here...
  body
    include navbar
    div.cont
      div#row-fluid
        a.slice#four(href="#fourbox")
          div.subwindow
            block blog

In the same directory I have a file named blog.jade with the follow code in it:

extends index

block blog
  .container-fluid(style="height:100%;")
      body(style="margin:0px;padding:0px;overflow:hidden")
        iframe(src="http://website.com", frameborder="0", style="overflow:hidden;height:100%;width:100%", height="100%", width="100%")

When I run my server in express, the index loads, but fails to populate #four with the correct contents. Am I doing anything wrong in this code?

Upvotes: 0

Views: 141

Answers (1)

jmingov
jmingov

Reputation: 14003

The trouble is in the server side cause your jade looks good:

try on the app.get('/', ...);

res.render('blog', { ... })

not

res.render('index', { ... })

p.s. you have two body tag body(style="margin:0px;padding:0px;overflow:hidden") care here

And if your index allways include the blog file:

try remove these lines @blog.jade

extends index

block blog

and change @index.jade

block blog ---> include blog

Upvotes: 2

Related Questions