Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8982395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:34:06+00:00 2026-06-15T20:34:06+00:00

This is my configure file: The layout.jade does not seem to be working. But

  • 0

This is my configure file:
The layout.jade does not seem to be working. But the jade is working. I used Chrome to check, and am sure that the layout HTML is not loaded into the page.

module.exports = function(app, express, mongoose){
    var config=this

    app.configure(function (){
        app.set('views',__dirname+'/views')
        app.set('view engine','jade')
        app.set('view options', {layout:true})

        app.use(express.bodyParser())
        app.use(express.methodOverride())
        app.use(express.cookieParser())
        app.use(express.session({secret: 'topsecret',store: new express.session.MemoryStore}))
        app.use(express.static(app.path.join(app.application_root,"public")))
        app.use(express.errorHandler({dumpExceptions:true,showStack:true}))
        app.use(express.bodyParser({keepExtensions: true, uploadDir:"./public/uploads"}))
        app.use(app.router)
    })

    /*DB part:*/
    app.mongoose.connect('mongodb://localhost/dio_database')

    return config
}

The render command:

app.get('/items/:id',function(req,res){
    models.ItemModel.findOne({_id:req.params.id}).exec(function(err,item){
        if (!err){
            res.render('item.jade',item)
        } else
            return console.log(err)
    })
})

My layout.jade, quite simple:

!!!
doctype 5
html
    head
        title "Dio"
        link(rel='icon', href='favicon.ico', type='image/x-icon')
        link(rel='shortcut', href='favicon.ico', type='image/x-icon')
        link(rel="shortcut", href="favicon.ico", type="image/vnd.microsoft.icon")
        link(rel="icon", href="favicon.ico", type="image/vnd.microsoft.icon")

        script(src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js")
        script(src="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js")
        script(src="./javascripts/underscore-min.js")
        script(src="./javascripts/backbone-min.js")

        link(rel='stylesheet', href='./css/main.css', type="text/css", media="screen")
    body
        div#topbar Dio--where shitty thing happens
        div#main!= body
            footer
                p
                    | Node.js MVC template by XXX

And the following is my npm list:

├─┬ bcrypt@0.7.3
│ └── bindings@1.0.0
├─┬ express@3.0.3
│ ├── commander@0.6.1
│ ├─┬ connect@2.7.0
│ │ ├── bytes@0.1.0
│ │ ├── formidable@1.0.11
│ │ ├── pause@0.0.1
│ │ └── qs@0.5.1
│ ├── cookie@0.0.5
│ ├── cookie-signature@0.0.1
│ ├── crc@0.2.0
│ ├── debug@0.7.0
│ ├── fresh@0.1.0
│ ├── methods@0.0.1
│ ├── mkdirp@0.3.3
│ ├── range-parser@0.0.4
│ └─┬ send@0.1.0
│   └── mime@1.2.6
├── fs@0.0.0
├── imagemagick@0.1.3
├─┬ jade@0.27.7
│ ├── coffee-script@1.4.0
│ ├── commander@0.6.1
│ └── mkdirp@0.3.4
├─┬ mongodb@1.2.2
│ └── bson@0.1.5
├─┬ mongoose@3.4.0
│ ├── hooks@0.2.1
│ ├─┬ mongodb@1.1.11
│ │ └── bson@0.1.5
│ ├── ms@0.1.0
│ └── sliced@0.0.3
├─┬ node-static@0.6.5 extraneous
│ ├── colors@0.6.0-1
│ └─┬ optimist@0.3.5
│   └── wordwrap@0.0.2
└── path@0.4.9
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:34:08+00:00Added an answer on June 15, 2026 at 8:34 pm

    Actually the reason for such problem is quite simple:
    Express 3 no longer supports layout..But do not be sad. Actually Express 3 begins to adopt a more natural and easier way, which is called block/extends.
    The basic usage should be like this:

    // In layout file: layout.jade
    html 
        head
            title XXX
            block scripts
        body
            block content
            block footer
    
    
    // in a extended file, for example index.jade:
    extends layout
    block scripts
        //write javascript part
    block content
        // write content
    block footer
        // write the footer
    

    It actually becomes easier and more flexible. Glad to get it finally. But it took me more than 2 hours.

    I am just wondering why so few people mentioned this change more clearly and openly. Hope this post can help some people like me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use log4net with an external config file, but it does not
Please refer to this post. I have become able to configure my web.config file
I get this error: 500 Error: ENOENT, open 'C:\Users\Gilbert\WebstormProjects\games\views\layout.hbs but my project has no
My settings: My directory structrue looks like this: /views/ |-- index.jade |-- layout.jade /account/
I am trying to configure log4j for the first time but its not creating
This is a Bad Idea, I know, but... I want to configure log4net programmatically
How to configure NLog Layout to get a source file name and row number
This is my Student class that used to test log4j. public class Student{ private
I used this guide on Apple's website to enable PHP on my computer but
I am configure log4net to use a composite RollingFileAppender so that the current file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.