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

  • Home
  • SEARCH
  • 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 9015559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:46:41+00:00 2026-06-16T03:46:41+00:00

I just added another Jade template to my express project, and now it renders

  • 0

I just added another Jade template to my express project, and now it renders blank pages, with empty head and body tags. It works when index.jade extends layout.jade, but it breaks if layout.jade extends logo.jade. There are no errors in the console.

Here is a simplified version of the project, which works fine.

app.js:

var express = require('express'),
    http = require('http'),
    path = require('path'),
    request = require('request');

var app = express();

app.configure(function(){
    app.set('port', process.env.PORT || 3000);
    app.set('views', __dirname + '/views');
    app.set('view options', {'layout': false});
    app.set('view engine', 'jade');
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(app.router);
    app.use(express.static(path.join(__dirname, 'public')));
});

app.configure('development', function(){
    app.use(express.errorHandler());
});

app.get('/', function(req, res){
    res.render('index', {title: 'A Title'});
});

http.createServer(app).listen(app.get('port'), function(){
    console.log("Express server listening on port " + app.get('port'));
});

views/index.jade:

extends layout

block content
    p Hello

views/layout.jade:

doctype 5
html(xmlns='http://www.w3.org/1999/xhtml')
    head
        title= title
        link(rel='stylesheet', href='/stylesheets/style.css')
    body
        h1= title
        block content

Adding logo.jade and extending it from layout.jade breaks Jade rendering.

GET http://localhost:3000/

responds

200 OK
content-length: 0

modified views/layout.jade:

extends logo

doctype 5
html(xmlns='http://www.w3.org/1999/xhtml')
    head
        title= title
        link(rel='stylesheet', href='/stylesheets/style.css')
    body
        block logo
        h1= title
        block content

new views/logo.jade:

block logo
    svg(xmlns='http://www.w3.org/2000/svg')
        rect(
            stroke='black'
            fill='blue'
            x='45'
            y='45'
            width='20px'
            height='30px'
            stroke-width='1')
  • 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-16T03:46:42+00:00Added an answer on June 16, 2026 at 3:46 am

    Take care with layouts, templates and partials.

    When you tell express to render a page with jade, it looks for the matching template file (for example logo.jade). This is the entry point and from there on the page is rendered.

    If you want to use a layout, you have to tell it in your template file. If you look at the index.jade, it says that the layout.jade should be extended. In you logo.jade there is no such declaration, so there is nothing to render as the logo block is not defined. If you want to use partials (include in jade), you have to tell so in the template file.

    Blocks in your layout file are just placeholders that can be extended or overwritten or even left empty. I would suggest to add the logo directly to your layout or to include it. See Jade documention on includes for more information.

    So your layout.jade should look like this:

    doctype 5
    html(xmlns='http://www.w3.org/1999/xhtml')
        head
            title= title
            link(rel='stylesheet', href='/stylesheets/style.css')
        body
            include includes/logo
            h1= title
            block content
    

    And the new includes/logo.jade:

    svg(xmlns='http://www.w3.org/2000/svg')
        rect(
            stroke='black'
            fill='blue'
            x='45'
            y='45'
            width='20px'
            height='30px'
            stroke-width='1')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just added yet another 3rd-party component to my .net project that contains a
I just added a new Word AddIn project to my blank solution and just
In my Android project I just have one Activity - MainActivity.java. I added another
I just added users into my Wordpress installation from another CMS, and now I
I just added PrimeFaces 3.0 to a JSF project: <repository> <id>prime-repo</id> <name>PrimeFaces Maven Repository</name>
I have a Java GUI project containing a JMenuBar and I just added a
I have a UITableView that I just added to my project and the option
I have just added another website to my Magento eCommerce site and I would
Having just added a new button in my web application, I get an error
I just added this to my web.xml on my JBOSS server. But it had

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.