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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:50:59+00:00 2026-06-13T10:50:59+00:00

My structue is the following: Hi have a heading a template called headingit looks

  • 0

My structue is the following:

Hi have a heading a template called “heading”it looks like this

div.span4
    block headingleft
div.span3
    block headingright

what I am trying to achieve is , from my main page I want to pass block values for headingleft and heading right, i.e. something like

div
include heading
    block headingleft
          a IamLeft 
    block headingright
          a IamRight

But the behavior for the code is: instead of putting “IamLeft” in .span4 and IamRight in .span3 it is putting both under .span3 as if it was just normal jade append

  • 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-13T10:51:00+00:00Added an answer on June 13, 2026 at 10:51 am

    I’ll give it a try and explain some essentials since you’re probably mixing up some jade techniques and got confused by the definition of “blocks”.

    I’ll give you two examples targeting your use-case (with slight modifications):

    includes

    Using the include technique means you substitute content of your master (layout) template by the contents of other template files. When including other jade template files you may pass additional content to the included file to be appended or yielded at some place.

    main.jade:

    div
      include heading
        div.span3
          a IamSomewhatRight
    

    heading.jade:

    div.span4
      a IamLeft
    div.span3
      a IamRight
    

    Result:

     div
       div.span4
         a IamLeft
       div.span3
         a IamRight
       div.span3
          a IamSomewhatRight
    

    As you see, the additional and optional content, i.e. the block below include heading, is by default appended to the content of the include file. Use the keyword yield to define the exact place for substitution. Please note that this has nothing to do with block definitions that are defined by the keyword block as explained below.

    Blocks

    If you define blocks within a master template, you can extend this template for concrete use and describe how to substitute these blocks – that is done within your inherited template:

    main.jade:

    div
      block headingleft
      block headingright
    

    heading.jade:

    extends main
    
    block headingleft
      div.span4
        a IamLeft 
    
    block headingright
      div.span3
        a IamRight
      div.span3
        a IamSomewhatRight
    

    Result is exactly as the result in the “Includes” example. Of course it may make sense here to transform your heading.jade into some myview.jade and cover the whole page generation.

    Now, there are different situations and requirements for using either includes or blocks or both of them combined in various ways for composing your views (and it’s kind of philosophy!). Using inheritance is – in my opinion – a nice way to eliminate the repetition of several “main files” – or some kind of controller based view composition techniques defining placeholder variables (or whatsoever) which often results in cluttered code that does not follow the “separation of concerns” approach.

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

Sidebar

Related Questions

I have something that looks like the following document structure: public class Document {
In my rails view(index.html.erb), i have following structure <div> <%= render :partial => create
I have the following structure: <div class=parent> <div id=child1>Content here</div> <div class=child2>Content here</div> </div>
I have the following structure: <div id=content-header> <h1 id=title>Athletics Calendar</h1> </div> and the following
I have following structure of an HTML document: <body> <div class=main> <div class=left></div> <div
I have following structure <div onClick=javascript:Myfunction('value');> <div title=Mytitle> </div> </div> Can I access in
in my webapp I have a variable like this var data = { getItem:
i have following html structure. <p class=expandableContent ><span class=label>Computer and Laptop Repairs</span></p> <div style=clear:
I have three divs in a container: <div id=container> <h2>Heading</h2> <div id=left> An image
I have questions which are represented like this in my SQL database : CREATE

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.