Layout which depends on another layout / Nested layouts

Hey!

I migrated to Hugo from Jekyll today so I am very new and I’m enjoying it a lot.

But it was possible in Jekyll to have a layout that depends on another one

_layouts/default.html

<html>
<head>
</head>
<body>
    {{ content }}
</body>
</html>

_layouts/post.html

---
layout: default
---

<main>
    <article>
        {{ content }}
    </article>
</main>

And the output of a page using the post layout would be

<html>
<head>
</head>
<body>
    <main>
        <article>
            <!-- content -->
        </article>
    </main>
</body>
</html>

I havent found any way to do this in Hugo. Is it possible? Thanks!

Solved, I figured out it was not using the baseof layout because I put code outside of the define blocks

Code that you put outside the block definitions can break your layout. This even includes HTML comments.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.