Documentation — Table of Contents
navigator-core
Note: The options API is still evolving; expect tweaks as the project grows.
What it does
- Adds a Nunjucks global
_navigatorto inspect the full render context (handy for debugging). - When
enableNavigatorTemplateis true, registers a virtual page at/navigator-core.html. _navigatorand_contextglobals are always available; the template is optional.
See the Navigator template in action.
Default configuration
eleventyConfig.addPlugin(baseline({ enableNavigatorTemplate: false }));
How it works
- Registers
_navigator()to return the current Nunjucks context. - Registers
_context()— a child of_navigator(). - If
enableNavigatorTemplate: true, adds the bundlednavigator-core.htmltemplate withinspectorDepth(default2, or pass[true, depth]).
Example usage
{% for key, value in _navigator() %}
<details>
<summary><strong>{{ key }}</strong></summary>
{% if value | isString %}
<pre>{{ value | safe }}</pre>
{% else %}
<pre>{{ value | _inspect({ depth: inspectorDepth }) }}</pre>
{% endif %}
</details>
{% endfor %}
Tips
- You can set the depth of the inspector by using a tuple:
baseline({ enableNavigatorTemplate: [true, 4] }) _navigator()and_context()in combination with the_inspect()filter can be a powerful debugging tool.- The virtual navigator page is excluded from collections and served at
/navigator-core.htmlwhen enabled. - Enable the template only in local dev; disable in production. See the “Debugging & Navigator” tutorial for usage patterns.
- Tutorial: Debugging & Navigator
Previous: multilang-core
Next: sitemap-core