Eleventy Plugin Baseline

A magic carpet ride

Table of Contents

navigator-core

Note: The options API is still evolving; expect tweaks as the project grows.

_navigator() and _context() dump the full render context (may include secrets). These globals are always registered. Only use them and the virtual template in local development or secured environments.

What it does

  • Adds a Nunjucks global _navigator to inspect the full render context (handy for debugging).
  • When enableNavigatorTemplate is true, registers a virtual page at /navigator-core.html.
  • _navigator and _context globals are always available; use with care (debug only).

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 bundled navigator-core.html template with inspectorDepth (default 2, 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.html when 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