mozilla / nunjucks

A powerful templating engine with inheritance, asynchronous control, and more (jinja2 inspired)
https://mozilla.github.io/nunjucks/
BSD 2-Clause "Simplified" License
8.48k stars 635 forks source link

Is there a way to specify a fallback when including a template? #1382

Open kruncher opened 2 years ago

kruncher commented 2 years ago

Is there a way to fallback to a different include when the preferred one doesn't exist?

For example,

{% include entry.layout + ".njk" else "default.njk" %}