Cheat Sheet

The cheat sheet is still under construction, but here is a first part.

Page properties

---
title: Page title
layout: default
---

Output page properties in layout and content files:

{{ page.title }}
{{ page.layout }}

Allowed file extensions
htm, html, markdown, md, rss, rst, textile, txt, xml

Homepage
index.md

Content segments

--- default ---
--- left ---
--- right ---

Output content segments in layout files:

{{ content.default }}
{{ content.left }}
{{ content.right }}

Event Listeners

Name Description
ContentRenderedEvent Triggered after content was rendered
LayoutRenderedEvent Triggered after layout was rendered
PluginsInitializedEvent Triggered after plugins where initialized
RenderLayoutEvent Triggered when layout is rendered
RenderPageEvent Triggered when page is rendered
RenderSegmentEvent Triggered when segment is rendered
ResponseEmittedEvent Triggered after HTTP Response was emitted
ResponseGeneratedEvent Triggered after HTTP Response was generated
TranslatorInitializedEvent Triggered after translator was initialized
TwigInitializedEvent Triggered after twig was initialized

Twig Filters

Name Description
format_size Returns file size in a human readable format (B, KB, MB, GB, TB, PB).
slugify Returns a string slug for using as an URL segment.
visible Filters the page tree by visible and active page items.

Twig Globals

Name Description
content The rendered content with one or more content segments. Available only in layout files.
page The page object with its properties and methods.
site The site object with its properties and methods.

Twig Functions

Name Description
css_add Adds a CSS asset to the HTML page.
css_classes Returns a string with CSS classes, to be used within an HTML attribute, for example the html or body tag. This allows to address any page, theme, layout or language via CSS selector. Such a string looks like: "page-blog theme-default layout-blog language-en"
css_out Outputs the CSS assets for a given group.
image Returns an image markup tag. No image processing is performed.
js_add Adds a JavaScript asset to the HTML page.
js_out Outputs the JavaScript assets for a given group.
link_file Returns a link to a file with additional info like file type and size.
link_mail Returns a HTML mailto link.
link_media Returns a HTML link with a file from site/media folder.
link_page Returns a HTML link with label and attributes for a given route or an URL.
menu_ascii_tree Creates a text based (=ascii) tree of all pages. All parameters are optional and passed as named parameters.
menu_breadcrumb Returns a breadcrumb path for the given page. All parameters are passed as an associative array.
menu_list Returns a paginated list of page items with links to the first, previous, next, and last page. For the paging the GET query parameter "page" is used.
menu_pager Creates a pagination with links to the previous an next page within the current page branch. All parameters are optional and passed as named parameters (see twig).
menu_sitemap Creates a simple sitemap for all pages of the website based on an unordered list. All parameters are optional and passed as named parameters.
menu_tree Returns an HTML menu as unordered list. All parameters are optional and passed as named parameters.
page_title Returns the SEO optimized page title of the website. All parameters are optional and passed as named parameters.
query Find entries with the help of the built-in fluent query builder. The query builder can be applied to any type of iterable data structure. The queried data can be narrowed down, filtered, sorted and limited.
snippet Includes a snippet and outputs the rendered content of that file. Automatic escaping is disabled for all escaping strategies.
translate Translates a string according to the configuration and locale settings.
url_abs Returns the absolute URL for a given route.
url_rel Returns the relative URL to a given route.

Twig Tests

Name Description
file_readable Tests if the given alias or path exists and is readable.
file_writable Tests if the given alias or path exists and is writable.

Console Commands

Name Description
clear-files The clear-files command deletes asset, cache and log files from several directories.

Plugins

Name Description
Dummy This system plugin shows all possibilities how to extend Herbie. The plugin is helpful during development, but should be disabled in productive environment.
Imagine This system plugin integrates Imagine, an OOP image editing library, into your Herbie website. Thanks to Imagine, you can edit images directly and apply ready-made filters and effects to them.
Markdown This system plugin can be used to parse markdown-formatted texts. Internally, the plugin is responsible for parsing markdown-formatted page content.
Simplecontact Simplecontact adds a simple contact form with name, email and message fields to a website created with Herbie.
Simplesearch Simplesearch adds a simple but effective search functionality to a website created with Herbie.
Textile This system plugin can be used to parse textile-formatted texts. Internally, the plugin is responsible for parsing textile-formatted page content.
Twig This system plugin provides several Twig filters, functions and tests that are useful for creating a web project with Herbie.
reStructuredText This system plugin can be used to parse reStructuredText-formatted texts. Internally, the plugin is responsible for parsing reStructuredText-formatted page content.