Nesting block templates

Using the block template feature, I’ve defined an outer shell for my site. Now I’d like to define another block template which should “extend” that first one and be used for some specific sections. Is such “nesting” or “extending” of block templates possible? I couldn’t find this in the docs, but maybe there is a way to make this work? Thanks for any pointers!

1 Like

No such thing.

If you need several base templates I think you will get what you want by composition, i.e. partials.

Also note that blocks can have default content that can be overridden in the template.

Thanks for the quick reply. I’ll go for partials as you suggest

Nested block templates would be a great addition, though. With partials I’m still having some redundancy (in the structure of the templates that include the partials) whereas nested block templates would allow to define the outer structures only once and just refine inner parts as needed.

As I said, that is possible by doing an override of the blocks, but you will have a fixed number of sections.

If you want something more advanced, you will have to raise an issue at Issues · golang/go · GitHub

If anyone like me will come across this topic in a search for nested or extended templates/partials, partials with .Inner or whatever else:
You should look at base templates and blocks.