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.

What it does

navigator-core registers two Nunjucks globals — _navigator() and _context() — for inspecting Eleventy's render context during development. Optionally, it adds a virtual debug page at /navigator-core.html that renders a full data snapshot. The globals are always available; the virtual page is off by default.

See the Navigator template in action.

_navigator() and _context() dump the full render context and may include secrets from your data layer or environment. Only use them in local development or secured environments.

Defaults

  • enableNavigatorTemplate: false — globals are registered, but the virtual page is not.
  • Inspector depth: 2 (how deep _inspect renders nested objects on the virtual page).

Options

Option Type Default Description
enableNavigatorTemplate boolean or [boolean, number] false Register the virtual page. Pass [true, depth] to set a custom inspector depth.

How it works

  1. Globals.

    Registers _navigator(), which returns the current Nunjucks environment object — everything Eleventy makes available during rendering. _context() returns _navigator().ctx, the template context specifically. Both are always registered, regardless of the template option.

  2. Virtual page.

    When enableNavigatorTemplate is truthy, navigator-core adds a bundled template at /navigator-core.html. The page is excluded from collections and iterates over _navigator(), rendering each key with _inspect() at the configured 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: 2 }) }}</pre>
    {% endif %}
  </details>
{% endfor %}

Tips

  • Set the inspector depth with a tuple: baseline({ enableNavigatorTemplate: [true, 4] }).
  • Pair _navigator() or _context() with _inspect() on any page for targeted debugging — you don't need the virtual page for that.
  • The virtual page renders a large snapshot. Keep it off in production; it exposes your full data cascade.
  • See Debugging & Navigator for usage patterns.

Peer deps

None.

Previous: multilang-core

Next: sitemap-core