Closed zslabs closed 8 years ago
That's not possible with metalsmith-layouts. Metalsmith-layouts has been created to allow you to use extends with templating languages that don't natively support it, like handlebars. So it doesn't process any templating syntax in the files in your src
, but just applies the selected template.
If you want to process templating syntax in the files in src
you can use metalsmith-in-place. It processes templating syntax in all files that you pass to it. You can either process all your templates with it (and omit metalsmith-layouts), or add it to your current build chain: metalsmith-in-place
See here for examples: metalsmith-in-place with extends
Let me know if you have any other questions!
@ismay Thanks for the example!
:+1: No problem!
Nunjucks template inheritance works by specifying an extends tag, like
{% extends 'default.html' %}
at the top of the file. What makes this tricky with metalsmith-layouts is if I specifydefault: 'default.html'
as one of the options, it automatically surrounds the content, but I can't hook into any blocks that have been specified in the extended template. Any thoughts on how I can do this?