Use Layout Chaining in eleventy

Khaled Garbaya
InstructorKhaled Garbaya

Share this video with your friends

Send Tweet
Published 2 years ago
Updated a year ago

In this video, you will learn how to use layout chaining with eleventy. Layouts in eleventy can use other layouts. You can also use a different template engine across layouts. This is very handy if we want to wrap some pages with extra markup but not all the pages.

for more information check out the eleventy docs

Khaled Garbaya: [0:00] Let's go the includes, create a new file and call it "main layout." In the front matter data let's type layout. This will be myLayout. In here let's do main style color red.

[0:40] In there, we'll have content and close our main. Now, let's go to the and instead of myLayout let's change this to mainLayout, and hit Save. You can see here that for just the posts, we can set the title to right. That's how you use layout chaining in Eleventy.