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.

TagDescription
isCheck the context of the current route
foreachLoop helper designed for working with lists of posts
ifTest very simple conditionals
unlessThe opposite of {{#if}}
hasLike {{#if}} but with the ability to do more than test a boolean
getSpecial 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.

TagDescription
@configProvides access to global data properties
@siteProvides access to global settings
navigationHelper which outputs formatted HTML for navigation links
postMore object than helper – Contains all data for a specific post
urlThe post URL, when inside the post scope
titleThe post title, when inside the post scope
img_urlOutputs the correctly calculated URL for the provided image property
excerptOutputs the custom excerpt, or the post content with HTML stripped
contentOutputs the full post content as HTML
dateOutputs the date in a format of your choosing
tagsOutputs the post tags
authorsOutputs the post author(s)
twitterOutputs the full URL to the Twitter profile from Settings
facebookOutputs 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.

TagDescription
assetOutputs cachable and cache-busting relative URLs to various asset types
ghost_head / ghost_footOutputs vital system information at the top and bottom of the document
partialsInclude chunks of reusable template code
blockUsed along with {{contentFor}} to pass data up and down the template hierarchy
body_classOutputs dynamic CSS classes intended for the <body> tag
post_classOutputs classes intended for your post container
reading_timeRenders the estimated reading time for a post
paginationHelper which outputs formatted HTML for pagination links
prev_post / next_postWithin the post scope, returns the URL to the previous or next post
pluralOutput different text based on a given input
translateOutput text in your site language (the backbone of i18n)
encodeEncode text to be safely used in a URL
logIn development mode, output data in the console
@labsA collection of booleans, one for each of the options in Settings > Labs