{"_id":"5937b2388e8d9b002f1df27f","category":{"_id":"5937b2388e8d9b002f1df272","version":"5937b2378e8d9b002f1df26e","project":"542fe92a5eceb608003fddc8","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-04T12:45:40.548Z","from_sync":false,"order":3,"slug":"helper-reference","title":"Helper Reference"},"user":"542c5cfcddd3190e00228849","parentDoc":null,"project":"542fe92a5eceb608003fddc8","version":{"_id":"5937b2378e8d9b002f1df26e","project":"542fe92a5eceb608003fddc8","__v":1,"createdAt":"2017-06-07T07:58:47.936Z","releaseDate":"2017-06-07T07:58:47.936Z","categories":["5937b2388e8d9b002f1df26f","5937b2388e8d9b002f1df270","5937b2388e8d9b002f1df271","5937b2388e8d9b002f1df272","5937b2388e8d9b002f1df273","5937b2388e8d9b002f1df274"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0.0"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-05-18T11:00:58.684Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":23,"body":"The `:::at:::labs` variable provides access to [global data](/docs/handlebars#section-global-data) properties, which are available anywhere in your theme. \n\nFor each feature listed with a checkbox in the `settings/labs/` section of a blog, the [email protected]` global will provide a boolean flag which tells the theme developer whether or not the feature is enabled.\n\nAs of Ghost 0.8, there are two features which can be detected:\n\n*   [email protected]}}` – true if the Public API feature is enabled\n*   [email protected]}}` – true if the Subscribers feature is enabled\n\n#### Examples\n\nTest if subscribers is enabled before outputting HTML elements to surround a subscribe form, or before adding a subscribe button.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{{#if @labs.subscribers}}\\n<div class=\\\"subscribe-form\\\">\\n{{subscribe_form}}\\n</div>\\n{{/if}}\",\n      \"language\": \"handlebars\"\n    }\n  ]\n}\n[/block]\nIt is also possible to test if the publicAPI is enabled before using the get helper:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{{#if @labs.publicAPI}}\\n<div class=\\\"latest-posts\\\">\\n{{#get \\\"posts\\\" limit=\\\"3\\\"}}...{{/get}}\\n</div>\\n{{/if}}\",\n      \"language\": \"handlebars\"\n    }\n  ]\n}\n[/block]\nNote: 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.","excerpt":"@labs Helper - global data about enabled features","slug":"labs","type":"basic","title":"@labs"}

@labs

@labs Helper - global data about enabled features

The [email protected]` variable provides access to [global data](/docs/handlebars#section-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 [email protected]` global will provide a boolean flag which tells the theme developer whether or not the feature is enabled. As of Ghost 0.8, there are two features which can be detected: * [email protected]}}` – true if the Public API feature is enabled * [email protected]}}` – true if the Subscribers feature is enabled #### Examples Test if subscribers is enabled before outputting HTML elements to surround a subscribe form, or before adding a subscribe button. [block:code] { "codes": [ { "code": "{{#if @labs.subscribers}}\n<div class=\"subscribe-form\">\n{{subscribe_form}}\n</div>\n{{/if}}", "language": "handlebars" } ] } [/block] It is also possible to test if the publicAPI is enabled before using the get helper: [block:code] { "codes": [ { "code": "{{#if @labs.publicAPI}}\n<div class=\"latest-posts\">\n{{#get \"posts\" limit=\"3\"}}...{{/get}}\n</div>\n{{/if}}", "language": "handlebars" } ] } [/block] 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.