Closed bheisig closed 2 years ago
We have to make a clear distinction between
They are completely distinct, and this explains why macros or values defined in mkdocs-macros are not available in the usual mkdocs template.
You could however, "trickle" mkdocs-macros values to the mkdocs templates using the meta variables of a page, see https://github.com/fralau/mkdocs_macros_plugin/issues/83#issuecomment-844263415 .
Thanks for your work. I've been using your plugin for a while but now stumbled upon an issue: How can I use included variables in a extra template?
How to reproduce
In
mkdocs.yml
I've included a YAML file to use its content in various Markdown files (this is working fine):I've also added a static template to
mkdocs.yml
which generates an Atom feed:Using Jinja2 in this extra template is not the problem. But…
Actual behavior
When I want to use the macros plugin in
announcements.atom
……then I get an error on build:
When I use any variable from
data/announcements.yml
instead then I get an error that this variable is undefined.Expected behavior
Using marocs in extra templates should work. Alternatively, I'm happy about any workaround.
Environment
mkdocs v1.3.0
mkdocs-macros-plugin 0.7.0