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 site, 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.
<div class="subscribe-form">
</div>
It is also possible to test if the publicAPI is enabled before using the get helper:
<div class="latest-posts">
...
</div>
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.