1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Use Layout Chaining in eleventy

    Khaled GarbayaKhaled Garbaya
    11ty11ty

    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

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Discuss

    Discuss

    Transcript

    Transcript

    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 post.md 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.