I want to have a template "_layouts/template1.html" extend (Django-style) a template _layouts/default.html.
I'm putting this as a YAML front matter in _layouts/template1.html
---
layout: default
---
{{page.content}}
but apparently it doesn't work the way I'd like it to work (all the additional markup that is present in template1.html but IS NOT in default.html does not render). It looks like the file that uses template1 layout purely extends default.html.
Is there any way to have layouts inheritance in Jekyll?
Jekyll's Liquid templates extend pretty easily, you just have to be sure you're extending and not overwriting your desired template.
You may actually want to extend page and not default.
So, in your template Front Matter:
---
layout:page
---
What you mean is simply {{ content }}
.
Yes, layouts can be piped. In your case, if a page uses template1 layout, it is the content for template1. Then, the result of template1 is the content for default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With