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 8405977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:58:20+00:00 2026-06-09T22:58:20+00:00

I am new to Express for Node.js, and I was just setting up a

  • 0

I am new to Express for Node.js, and I was just setting up a simple app by following Pedro Teixeira’s Node Tuts Episode 9. I wanted to experiment with layout files, so I set the layout to be “true.” When I did that though, it didn’t render with my layout, only with my body. How should I get it to render correctly? Below is my app.js file, my index.jade, my layout.jade, and a screenshot of my rendered page.

app.js

var express = require('express');

var app = express.createServer();

app.configure(function () {
    app.use(express.logger();
});

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

app.get('/', function(request, response) {
    response.render('index');
});

app.listen(4000);

index.jade

h2 Hello
p World!

layout.jade

!!! 5
  html
    head
      title My template
    body
  #main
        h1 Content goes here
        p Testing 123
        #container!= body
  • 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-09T22:58:22+00:00Added an answer on June 9, 2026 at 10:58 pm

    If you are using Express 3 this is normal the way template are rendered has changed.

    Your layout needs to be like this:

    !!! 5
      html
        head
          title My template
        body
      #main
            h1 Content goes here
            p Testing 123
            block content
    

    And you templates:

    extends layout
    
    block content
      h1 Something
    

    Examples here:

    https://github.com/dotcloud/express-on-dotcloud/blob/master/app/views/layout.jade#L64

    https://github.com/dotcloud/express-on-dotcloud/blob/master/app/views/welcome.jade#L1

    If you are starting with Node and Express feel free to clone this demo/tutorial App:
    https://github.com/dotcloud/express-on-dotcloud

    You can fool with it localy and discover some nice features of Express 3, if you want to share your app it is all setup to be pushed to dotCloud.

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

Sidebar

Related Questions

I'm pretty new to Node.js/Express, but I think I'm slowly getting the hang of
New to Node.js and Express, I am trying to understand the two seems overlapping
I'm about to start a new project using node, backbone, underscore, and express among
I am new to node.js and I'm just trying to learn how to use
I'm tring to create a simple node- with express.js script that will sum 3
just installed new ubuntu vm to test around with node installed things in this
I got this simple script ulizting express framework and node-mysql. Basically, the code listens
I'm new to node.js, just starting.. i'm after a good node.js boilerplate and best
I just created a new database in Microsoft SQL Server Management Studio Express and
Hi all I've just started a new project using Visual Web Developer 2008 Express

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.