Search code examples
nunjucks

Are there any globally available variables in Nunjucks?


In particular, I'm looking for information such as the filename of the template being rendered. However, in general I'd like to know if there are any automatic global variables available to the template. I couldn't find any information in the documentation.


Solution

  • You can see all available vars in current context - https://stackoverflow.com/a/38881808/6121703

    Template can be render from web-url (see WebLoader) or string. So there is no filename, but source. In any case I don't find simple way to get this info.