The Ghost Themes Developer Hub

Welcome to the Ghost Themes developer hub. You'll find comprehensive guides and documentation to help you start working with Ghost Themes as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

@labs

@labs Helper - global data about enabled features

The @labs variable provides access to global data properties, which are available anywhere in your theme.

For each feature listed with a checkbox in the settings/labs/ section of a blog, the @labs global will provide a boolean flag which tells the theme developer whether or not the feature is enabled.

As of Ghost 1.0.0, there are two features which can be detected:

  • {{@labs.publicAPI}} – true if the Public API feature is enabled (enabled by default)
  • {{@labs.subscribers}} – true if the Subscribers feature is enabled (disabled by default)

Examples

Test if subscribers is enabled before outputting HTML elements to surround a subscribe form, or before adding a subscribe button.

{{#if @labs.subscribers}}
<div class="subscribe-form">
{{subscribe_form}}
</div>
{{/if}}

It is also possible to test if the publicAPI is enabled before using the get helper:

{{#if @labs.publicAPI}}
<div class="latest-posts">
{{#get "posts" limit="3"}}...{{/get}}
</div>
{{/if}}

Note: when these features are moved out of beta in future, there will be a point at which these properties are deprecated. Therefore it is very important to keep your theme up-to-date.

@labs

@labs Helper - global data about enabled features