Apply multiple templates to same markdown

We’ve got a requirement to render the same markdown to 2 or more different html files.

The basic idea is the main webpage.html is generated as usual, and then we have a print friendly template that will render another.html file.

I can also see this being needed for other types of specific targets like mobile or screen reader layout etc.

Is it possible to do this with Zola as it stands? I can only think of trying to use a taxonomy to try and do this, but this would result in the output being separated and having to coerce the paginator to get what I want.

Ideally I would like to just provide a list of templates in the section.md or page.md and if Zola see’s multiple templates need processing it just loops through them, generating the output to the same directory.

Something like this in my article.md markdown:

template = [“article.html”, “article_print.html”]

With both these templates in the \templates directory as you would expect.

Clearly there might be issues, for example with the slug but in principle is something like this worth including in Zola?

Thanks for reading this far :slight_smile:

It’s not possible right now. Where would the pages be generated since they should refer to the same content/slug/path?

Hi Keats,

It’s not possible right now.

Yes I guessed as much.

If it ever becomes possible I would expect all the templates to render to the default html path for the content being processed. I.e. the output would render to the same path. The slug conflict is more problematic.

Maybe allow for multiple slugs:

slug = ["first-template-slug", "second-temaplate-slug-print-friendly"]
template = ["first-template.html", "second-template-print-friendly.html"]

It’s just an idea, I’m sure there are more elegant solutions that might support backward compatibility for example as I would not want to create any breaking markup | toml changes.

Thanks for giving it a look over though.