Replies: 1 comment 4 replies
-
Looks like it's related to your overrides. I'd try to remove them and see if the error persists. If it's gone, check the diff between your overridden partial and the original. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
@squidfunk, wondering if you could speculate on this?
My colleague is seeing a problem that I think is caused by something in the environment of his new Mac. MkDocs and the Material theme are set up properly, along with the required supporting software, but when he attempts a build that uses Martin Donath's nav-item.html partial, the build fails with a jinja2 exception at the end of the trace. Last few lines of trace:
File "/Users/theme_overrides/partials/nav-item.html", line 154, in top-level template code
navigation items #} {{ render(nav_item, path, level) }}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/jinja2/runtime.py", line 777, in _invoke
rv = self._func(*arguments)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/theme_overrides/partials/nav-item.html", line 19, in template
#} {% set class = "md-nav__item" %} {% if nav_item.active %} {% set class =
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 485, in getattr
return getattr(obj, attribute)
^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'nav_item' is undefined
No output is generated, so probably the error occurs and stops the build on the first attempt to use the partial. This partial is crucial for us, because it reduces the size of the output HTML by showing only relevant portions of the TOC for each topic. The build works fine for me, and used to work on my colleague's old Mac, and we're using the same markdown file set as we always have. It feels like this must be a problem with the environment, and Jinja is the part complaining. Could there be some problem with the Jinja?
Full trace and partial attached.
jinja2-trace.txt
nav-item.html.txt
Beta Was this translation helpful? Give feedback.
All reactions