Helpers add additional functionally to Handlebars, the templating language Ghost themes use.
Functional helpers
Functional helpers are used to work with data objects. Use this reference list to discover what each handlebars helper can do when building a custom Ghost theme.
Tag | Description |
---|---|
foreach | Loop helper designed for working with lists of posts |
get | Special block helper for custom queries |
has | Like {{#if}} but with the ability to do more than test a boolean |
if | Test very simple conditionals |
is | Check the context of the current route |
match | Compare two values for equality |
unless | The opposite of {{#if}} |
Data helpers
Data helpers are used to output data from your site. Use this reference list to discover what each handlebars helper can do when building a custom Ghost theme.
Tag | Description |
---|---|
@config | Provides access to global data properties |
@custom | Provides access to custom theme settings |
@page | Provides access to page settings |
@site | Provides access to global settings |
@member | Provides access to member data |
authors | Outputs the post author(s) |
comments | Outputs Ghost's member-based commenting system |
content | Outputs the full post content as HTML |
date | Outputs the date in a format of your choosing |
excerpt | Outputs the custom excerpt, or the post content with HTML stripped |
Outputs the full URL to the Facebook profile from Settings | |
img_url | Outputs the correctly calculated URL for the provided image property |
link | Creates links with dynamic classes |
navigation | Helper which outputs formatted HTML for navigation links |
post | More object than helper – Contains all data for a specific post |
price | Outputs a price with formatting options |
readable_url | Returns a human-readable URL |
recommendations | Outputs a list of recommended sites |
tags | Outputs the post tags |
tiers | Outputs the post tier(s) |
title | The post title, when inside the post scope |
total_members | Outputs the number of members, rounded and humanised |
total_paid_members | Outputs the number of paying members, rounded and humanised |
Outputs the full URL to the Twitter profile from Settings | |
url | The post URL, when inside the post scope |
Utility helpers
Utility helpers are used to perform minor, optional tasks. Use this reference list to discover what each handlebars helper can do when building a custom Ghost theme.
Tag | Description |
---|---|
asset | Outputs cachable and cache-busting relative URLs to various asset types |
block | Used along with {{contentFor}} to pass data up and down the template hierarchy |
body_class | Outputs dynamic CSS classes intended for the <body> tag |
concat | Concatenate and link multiple things together |
encode | Encode text to be safely used in a URL |
ghost_head / ghost_foot | Outputs vital system information at the top and bottom of the document |
link_class | Add dynamic classes depending on the currently viewed page |
log | In development mode, output data in the console |
pagination | Helper which outputs formatted HTML for pagination links |
partials | Include chunks of reusable template code |
plural | Output different text based on a given input |
post_class | Outputs classes intended for your post container |
prev_post / next_post | Within the post scope, returns the URL to the previous or next post |
reading_time | Renders the estimated reading time for a post |
search | Output a working, pre-styled search button & icon |
translate | Output text in your site language (the backbone of i18n) |