Skip to main content

Golem Documentation

Michael Bernstein

golem.plugins.nav_helpers

Provide breadcrumbs navigation, flattened navigation trees, and template context helpers.

Overview

NavigationHelpersPlugin inspects the hierarchical site navigation structure

and active document context to enrich Chameleon template renderings with:

  • breadcrumbs: Ordered ancestor list from site root ("Home") to the current page.
  • nav_tree_flat: Ordered depth-first sequence of all navigation items with depth metadata.
  • Preservation of precomputed engine pagination (prev_page, next_page).

Module Attributes

class NavigationHelpersPlugin

PYTHON
class NavigationHelpersPlugin(GolemPlugin):

Provide breadcrumbs navigation, flattened nav tree, and context helpers.

home_title (str)

Display title for the root home breadcrumb. Defaults to "Home".

home_url (str | None)

Target URL for the root home breadcrumb. Defaults to context root_path or "/".

Examples

PYTHON
from golem.plugins.nav_helpers import NavigationHelpersPlugin

plugin = NavigationHelpersPlugin(home_title="Home")

Attributes

name

Default value: 'nav_helpers'

home_title

Default value: home_title

home_url

Default value: home_url

init

PYTHON
def __init__(self, home_title: str = 'Home', home_url: str | None = None, **extra: Any) -> None:

Initialize navigation helpers plugin with home breadcrumb configuration.

home_title (str, optional)

Label for the site root breadcrumb entry. Defaults to "Home".

home_url (str | None, optional)

Link URL for the root breadcrumb entry. Defaults to None.

**extra

Additional plugin configuration options.

from_config

PYTHON
@classmethod
def from_config(cls, config: Any = None) -> NavigationHelpersPlugin:

Instantiate NavigationHelpersPlugin from site configuration or dictionary.

config (Any, optional)

Site configuration object or dictionary. Defaults to None.

NavigationHelpersPlugin

Configured plugin instance.

on_template_context

PYTHON
@hookimpl
def on_template_context(self, context: PageContext, doc_path: Path) -> PageContext:

Intercept and enrich template context with breadcrumbs and flattened nav tree.

context (PageContext)

Chameleon template context dictionary.

doc_path (Path)

Path to the documentation source file being processed.

PageContext

Enriched template context containing breadcrumbs and nav_tree_flat.