Developer docs

Helpers

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
is Check the context of the current route
foreach Loop helper designed for working with lists of posts
if Test very simple conditionals
unless The opposite of {{#if}}
has Like {{#if}} but with the ability to do more than test a boolean
get Special block helper for custom queries

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
@site Provides access to global settings
navigation Helper which outputs formatted HTML for navigation links
post More object than helper – Contains all data for a specific post
url The post URL, when inside the post scope
title The post title, when inside the post scope
img_url Outputs the correctly calculated URL for the provided image property
excerpt Outputs the custom excerpt, or the post content with HTML stripped
content Outputs the full post content as HTML
date Outputs the date in a format of your choosing
tags Outputs the post tags
authors Outputs the post author(s)
twitter Outputs the full URL to the Twitter profile from Settings
facebook Outputs the full URL to the Facebook profile from Settings

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
ghost_head / ghost_foot Outputs vital system information at the top and bottom of the document
partials Include chunks of reusable template code
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
post_class Outputs classes intended for your post container
reading_time Renders the estimated reading time for a post
pagination Helper which outputs formatted HTML for pagination links
prev_post / next_post Within the post scope, returns the URL to the previous or next post
plural Output different text based on a given input
translate Output text in your site language (the backbone of i18n)
encode Encode text to be safely used in a URL
log In development mode, output data in the console
@labs A collection of booleans, one for each of the options in Settings > Labs