Twig Globals

The following variables are available in layout and content files.

Global Variables

Variable Description Type
baseUrl

The base url.

string
config

The configurations as Config object.

herbie\Config
page

Page wide variables.

herbie\Page
route

The requested route to a page, i.e. documentation/variables.

string
routeParams

The requested route params.

array
site

Project-wide variables.

herbie\Site
theme

The configured theme.

string

Site Variables

Variable Description Type
site.charset

The charset (default: utf-8)

string
site.created

The time of the last recent created page in ISO-8601 format (2004-02-12T15:19:21+00:00).

string
site.data.<NAME>

Project wide data structures, which are located in site/data.

mixed
site.language

The language as 2-digit ISO-code (default: de)

string
site.locale

The locale settings (default: de_DE)

string
site.modified

The time of the last modified page in ISO-8601 format (2004-02-12T15:19:21+00:00).

string
site.pageList

A list of all available pages.

Traversable
site.pageTrail

A trail from the current page up to the root page.

Traversable
site.pageTree

A tree of all available pages.

Traversable
site.time

The current time in ISO-8601 format (2004-02-12T15:19:21+00:00).

string

Page Variables

Variable Description Type
page.authors

One or more authors of the page

string[]
page.cached

If set the page is cached (depending if caching is active)

bool
page.cache_id

The cache ID used for identifying when caching (read-only)

string
page.categories

One or more categories, that belongs to the page

string[]
page.content_type

The Content-Type of the page for the HTTP response, automatically set by Herbie.

string
page.created

The creation time of the page. This value is not set automatically.

string
page.date

The date of the page. The modification date or an explicitly set date.

string
page.excerpt

The excerpt of the page body.

string
page.format

The formatter like markdown or textile. Is set automatically depending on the file extension.

string
page.hidden

If set the page is not visible in navigation elements like sitemap or breadcrumb.

bool
page.id

The aliased ID of the page like @page/2-company/3-about-us.md.

string
page.keep_extension

If true the file extension is used for urls. Useful for xml pages like sitemap for search engines.

bool
page.layout

The layout as basename (without file extension). Layout files are located in folder site/themes/.

string
page.menu_title

The title for menu elements like sitemap or breadcrumb. If empty the page title will be shown.

string
page.modified

The modification time of the page as ISO 8601 formatted string. This value is set automatically.

string
page.parent_id

The aliased parent ID of the page like @page/2-company/1-index.md

string
page.parent_route

The parent route of the page like company.

string
page.path

The path to the page file, set per default.

string
page.redirect

If set the request will be redirected to the given page.

string|array
page.route

The route of the page like company/about-us.

string
page.segments

The page content as associative key value array. The content is lazy loaded and not available until this member variable is accessed.

array
page.tags

One or more tags that belongs to the page.

string[]
page.title

The title of the page.

string
page.twig

If set the page will be parsed by the Twig Renderer first (default: true).

bool
page.type

The page type (default: page).

string
page.<NAME>

Any numbers of custom variables.

mixed