I don’t think there’s support for what you want, in exactly the way you describe, sorry. As mentioned elsewhere macros are probably the most idiomatic way of doing this and what I’d recommend.
However, if you still want to do it, I think that there might be a way to emulate the same behavior that you were describing, although I haven’t tried it myself and I think that it might not work with template inheritance.
Let’s say you have a page called page1.md
as follows:
+++
template = "example.html"
+++
this is an example
So that page above has a template called example.html
. If you wanted to “render” the html of page1.md
but in the code you showed above, you may be able to do so by using {% include "example.html" %}
. What’s going to happen is whatever variables you have in the outer template will be made available to example.html
when include
is used. So, if you have a variable called page
for example, and that’s what example.html
normally uses, then you can probably emulate what you wanted.
Where I think this may be a problem for you is if have any kind of inheritance in your page’s template. I don’t think using includes
and using extends
really mix very well.
Again, I haven’t tested this myself, but I think it’s possible. Hope that helps!