Globals - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# Globals

Jinja2 globals are often data or functions that do not are not filters or tests.

## Built-in globals

In addition to Jinja2’s built-in globals, Betty provides the following:

`app` (`betty.app.App`)

  The currently running Betty application.

`citer` (`betty.html.Citer`)

  The ledger of citation references on the current page.

`breadcrumbs` (`betty.html.Breadcrumbs`)

  The ledger of breadcrumbs on the current page.

`entity_contexts` (`betty.jinja2.EntityContexts`)

  The ledger of primary entities in the current template context.

`generate_html_id` (`betty.jinja2.globals.generate_html_id()`)

  A function to generate a HTML ID unique within the current render call, such as a page.

`localizer` (`betty.locale.localizer.Localizer`)

  The localizer for the current template context.

`project` (`betty.project.Project`)

  The project the template is being rendered for.

`public_css_paths` (a sequence of `str`)

  The paths to the public CSS files used for all pages.

`public_js_paths` (a sequence of `str`)

  The paths to the public JS files used for all pages.

`today` (`betty.date.Date`)

  The current date.