Skip to main content

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

TagDescription
@configProvides access to global data properties
@customProvides access to custom theme settings
@pageProvides access to page settings
@siteProvides access to global settings
@memberProvides access to member data
authorsOutputs the post author(s)
commentsOutputs Ghost's member-based commenting system
contentOutputs the full post content as HTML
dateOutputs the date in a format of your choosing
excerptOutputs the custom excerpt, or the post content with HTML stripped
facebookOutputs the full URL to the Facebook profile from Settings
img_urlOutputs the correctly calculated URL for the provided image property
linkCreates links with dynamic classes
navigationHelper which outputs formatted HTML for navigation links
postMoreobject than helper – Contains all data for a specific post
priceOutputs a price with formatting options
readable_urlReturns a human-readable URL
recommendationsOutputs a list of recommended sites
tagsOutputs the post tags
tiersOutputs the post tier(s)
titleThe post title, when inside thepost scope
total_membersOutputs the number of members, rounded and humanised
total_paid_membersOutputs the number of paying members, rounded and humanised
twitterOutputs the full URL to the Twitter profile from Settings
urlThe post URL, when inside thepost 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.

TagDescription
assetOutputs cachable and cache-busting relative URLs to various asset types
blockUsed along with{{contentFor}} to pass data up and down the template hierarchy
body_classOutputs dynamic CSS classes intended for the<body> tag
concatConcatenate and link multiple things together
encodeEncode text to be safely used in a URL
ghost_head / ghost_footOutputs vital system information at the top and bottom of the document
link_classAdd dynamic classes depending on the currently viewed page
logIn development mode, output data in the console
paginationHelper which outputs formatted HTML for pagination links
partialsInclude chunks of reusable template code
pluralOutput different text based on a given input
post_classOutputs classes intended for your post container
prev_post / next_postWithin thepost scope, returns the URL to the previous or next post
reading_timeRenders the estimated reading time for a post
searchOutput a working, pre-styled search button & icon
translateOutput text in your site language (the backbone of i18n)