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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:44:27+00:00 2026-05-28T15:44:27+00:00

Jade template inheritance in Jade is driving me mad… The problem is that I

  • 0

Jade template inheritance in Jade is driving me mad…

The problem is that I would like to exclude a large bit of code to external template and then include it. When I do so everything gets f** up :/

Sample code:

!!!5
html(lang="en")
  head
    title sample title
  body
    header
      div#someDiv
        div#someContent
          section#main

Let’s say I want to exclude everything from top to div#someContent. Then I would have

include inc/header
          section#main

This way code indentation goes wrong and everything is messed up :/ Can you point me to the right direction in including templates?

Thanks in advance!

  • 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-05-28T15:44:28+00:00Added an answer on May 28, 2026 at 3:44 pm

    This is not template inheritance, but includes (template inheritance is with block and extends keywords). I did try your code, and what it does with the include is insert “section#main” into “div#someDiv” instead of “div#someContent”. Not sure if this should be considered a bug or what (how can the parser know if the added content should be inside the last item in the include file, or at the same level?). It doesn’t seem to care about the level of indentation under the “include” statement.

    However, if you DO use template inheritance, you can put an empty block at the end of your include:

    !!!5
    html(lang="en")
        head
            title sample title
        body
            header
                div#someDiv
                    div#someContent
                        block content
    

    Then you can append the block in your actual content file:

    include inc/header
        block append content
            section#main
    

    And this renders OK in the DOM (section#main is inside div#someContent). Depending on the structure of your views, you may be better off with “extends” instead of “include + block append”. You can check Jade’s GitHub doc for the details.

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

Sidebar

Related Questions

I have a jade template for my node.js project. I would like to send
I have a problem with scoping when using locals in my Jade template. My
I want to use underscore function in jade template, like this p= _.keys(user) Not
I'd like to do something like the following within a jade template. include page-content/#{view.template}
I'm currently experimenting with jade template engine. I've got the follow basic code in
Using Express.js, I'd like to render a partial-view from a Jade template to a
I have a Jade template that needs to call a helper, but not display
I've recently been playing with nodejs and would like to build my first project
I have the following HTML structure: (jade template language) #review-item-1.review-item a.submit-review-toggle(href=#).review-item-toggle + h3 Service
Hi I would like to know how can I render output in dot.js templating

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.