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 trialBruno Navarrete
Full Stack JavaScript Techdegree Graduate 22,246 PointsNesting inside HTML elements
I ran into this question while juggling a Laravel template a while ago. What happens if I want to repeat the section#content across the board? Should I repeat it in every pug file or can I go with:
section#content
block content
Which would be ideal and why?
1 Answer
nico dev
20,364 PointsHi Bruno Navarrete ,
Not sure if I understand correctly your question, sorry if I don't! Plus I am no expert in this, I am still another student learning along.
But I think in that case, there are two options:
you want it to have exactly the same content, in which case I think it would be great to just also include it in the layout.pug, right?
you want it to have different content on different scenarios, in which case I think you can make it into another include.
Does that makes sense?
nico dev
20,364 Pointsnico dev
20,364 PointsI mean if you try doing layout.pug like this:
And then, for example, do the index.pug and the card.pug like this:
That works. Not sure if that's what you mean, though.