{"category":{"version":"58c81e8e693cdd1900606acf","project":"542fe92a5eceb608003fddc8","_id":"58c81e8e693cdd1900606ad3","__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"},"parentDoc":null,"project":"542fe92a5eceb608003fddc8","user":"542c5cfcddd3190e00228849","version":{"__v":1,"_id":"58c81e8e693cdd1900606acf","project":"542fe92a5eceb608003fddc8","createdAt":"2017-03-14T16:47:10.620Z","releaseDate":"2017-03-14T16:47:10.620Z","categories":["58c81e8e693cdd1900606ad0","58c81e8e693cdd1900606ad1","58c81e8e693cdd1900606ad2","58c81e8e693cdd1900606ad3","58c81e8e693cdd1900606ad4","58c81e8e693cdd1900606ad5"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"0.11.7","version":"0.11.7"},"_id":"58c81e8e693cdd1900606af1","__v":0,"updates":["54674636016b480800bc7bb1","54e0c0fd817f5d0d00a6b514"],"next":{"pages":[],"description":""},"createdAt":"2014-10-04T19:35:37.508Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"never","params":[],"url":""},"isReference":false,"order":38,"body":"[block:html]\n{\n  \"html\": \"<div class=\\\"github-deeplinks\\\">\\n    <a href=\\\"https://github.com/TryGhost/Ghost/blob/0.10.0/core/server/helpers/is.js\\\"><i class=\\\"fa fa-github-alt fa-right\\\"></i>Source</a>\\n    <a href=\\\"https://github.com/TryGhost/Ghost/blob/0.10.0/core/test/unit/server_helpers/is_spec.js\\\" class=\\\"fa fa-check-square-o fa-right\\\">Tests</a>\\n</div>\"\n}\n[/block]\nUsage: `{{#is \"contexts\"}}`\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Type\",\n    \"h-1\": \"Parameters\",\n    \"h-2\": \"Attributes\",\n    \"0-0\": \"[Block](/docs/helpers#section-block), [Ghost](/docs/helpers#section-ghost)\",\n    \"0-1\": \"* contexts (string, comma-separated)\",\n    \"0-2\": \"n/a\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n### Description\n\nThe `{{#is}}` helper allows you to check the context of the current route, i.e. is this the home page, or a post, or a tag listing page. This is useful when using shared partials or layouts, to output slightly different context in different places on your theme.\n\n### Usage\n\nThe `is` helper takes a single parameter of a comma-separated list containing the contexts to check for. Similar to the `has` helper, the comma behaves as an `or` statement, with `and` being achieved by nesting helpers.\n\n```\n{{#is \"post, page\"}}\n   ... content to render if the current route represents a post or a page ...\n{{/is}}\n```\n\nAs with all block helpers, it is possible to use an else statement:\n\n```\n{{#is \"home\"}}\n  ... output something special for the home page ...\n{{else}}\n  ... output something different on all other pages ...\n{{/is}}\n```\n\nIf you only want the reverse, or negation, you can use the `^` character:\n\n```\n{{^is \"paged\"}}\n ...if this is *not* a 2nd, 3rd etc page of a list...\n{{/is}}\n```\n\n### Contexts\n\nThe following contexts are supported:\n\n* **home** - true only on the home page\n* **index** - true for the main post listing, including the home page\n* **post** - true for any individual post page, where the post is not a static page\n* **page** - true for any static page\n* **tag** - true for any page of the tag list\n* **author** - true for any page of the author list\n* **paged** - true if this is page 2, page 3 of a list, but not on the first page.\n* **private** - true if this is the private page shown for password protected blogs","excerpt":"`{{is}}` Helper - Test for the context a template is being output in","slug":"is","type":"basic","title":"is"}

is

`{{is}}` Helper - Test for the context a template is being output in

[block:html] { "html": "<div class=\"github-deeplinks\">\n <a href=\"https://github.com/TryGhost/Ghost/blob/0.10.0/core/server/helpers/is.js\"><i class=\"fa fa-github-alt fa-right\"></i>Source</a>\n <a href=\"https://github.com/TryGhost/Ghost/blob/0.10.0/core/test/unit/server_helpers/is_spec.js\" class=\"fa fa-check-square-o fa-right\">Tests</a>\n</div>" } [/block] Usage: `{{#is "contexts"}}` [block:parameters] { "data": { "h-0": "Type", "h-1": "Parameters", "h-2": "Attributes", "0-0": "[Block](/docs/helpers#section-block), [Ghost](/docs/helpers#section-ghost)", "0-1": "* contexts (string, comma-separated)", "0-2": "n/a" }, "cols": 3, "rows": 1 } [/block] ### Description The `{{#is}}` helper allows you to check the context of the current route, i.e. is this the home page, or a post, or a tag listing page. This is useful when using shared partials or layouts, to output slightly different context in different places on your theme. ### Usage The `is` helper takes a single parameter of a comma-separated list containing the contexts to check for. Similar to the `has` helper, the comma behaves as an `or` statement, with `and` being achieved by nesting helpers. ``` {{#is "post, page"}} ... content to render if the current route represents a post or a page ... {{/is}} ``` As with all block helpers, it is possible to use an else statement: ``` {{#is "home"}} ... output something special for the home page ... {{else}} ... output something different on all other pages ... {{/is}} ``` If you only want the reverse, or negation, you can use the `^` character: ``` {{^is "paged"}} ...if this is *not* a 2nd, 3rd etc page of a list... {{/is}} ``` ### Contexts The following contexts are supported: * **home** - true only on the home page * **index** - true for the main post listing, including the home page * **post** - true for any individual post page, where the post is not a static page * **page** - true for any static page * **tag** - true for any page of the tag list * **author** - true for any page of the author list * **paged** - true if this is page 2, page 3 of a list, but not on the first page. * **private** - true if this is the private page shown for password protected blogs