Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDante Harti
Courses Plus Student 2,813 Pointsblock content placement
I noticed that you placed the block content on the last line for the index.jade while for the post.jade, you place it under the extends keyword.
Is the placement of the block content important?
1 Answer
Iain Simmons
Treehouse Moderator 32,305 PointsYes, it tells the template rendering engine where the code should go.
In layout.jade
, the block is at the bottom because it's after all the navigation, etc. If there was a footer after the block, you would see that there.
In index.jade
and post.jade
, because they extend layout.jade
, they will get all the code from layout.jade
and then insert anything nested within (underneath and indented) the block content
, wherever that occurs in the extended template.
If you try and put anything outside of the blocks declared in the extended template, then you just won't see it, because it doesn't know where to put it.
Also, it doesn't matter if the extends
statement is below all of the block code... it just makes more sense to declare it right at the top so you know where the rest of the code is coming from and what blocks to use.