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 trial

JavaScript Express Basics (2015) Using Templates with Express Scaffolding Your Project’s Templates

Positioning of "extends ./layout.jade" and "block content"

Why did Houston add "extends ./layout.jade" and "block content" together at the top of the post.jade file and separately at the beginning and end of the index.jade file? Could he have done the same for both or switched them around for each?

Just curious to know if it matters or not and why?

1 Answer

Taking a closer look, we may find that Huston was adding "block content" keywords at the end of the "layout.jade" file rather than at the end of the "index.jade" file (notice the highlighted file, layout.jade, that he was using in the Sublime text editor at that time). Further, it will only work when both the following lines are placed at the top of "index.jade" and "post.jade" files as below:

extends ./layout.jade
block content