{"_id":"5937b2388e8d9b002f1df298","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","project":"542fe92a5eceb608003fddc8","parentDoc":null,"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":["54e552d9d71c112d0054416d"],"next":{"pages":[],"description":""},"createdAt":"2014-10-04T19:40:10.988Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"never","params":[],"url":""},"isReference":false,"order":48,"body":"[block:html]\n{\n  \"html\": \"<div class=\\\"github-deeplinks\\\">\\n    <a href=\\\"https://github.com/TryGhost/Ghost/blob/master/core/server/helpers/post_class.js\\\"><i class=\\\"fa fa-github-alt fa-right\\\"></i>Source</a>\\n    <a href=\\\"https://github.com/TryGhost/Ghost/blob/master/core/test/unit/server_helpers/post_class_spec.js\\\" class=\\\"fa fa-check-square-o fa-right\\\">Tests</a>\\n</div>\"\n}\n[/block]\nUsage: `{{post_class}}`\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Type\",\n    \"h-1\": \"Parameters\",\n    \"h-2\": \"Attributes\",\n    \"0-0\": \"[Output](/docs/helpers#section-output), [Ghost](/docs/helpers#section-ghost)\",\n    \"0-1\": \"n/a\",\n    \"0-2\": \"n/a\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n### Description\n\n`{{post_class}}` – outputs classes intended for your post container, useful for targeting posts with styles.\n\nThe classes are as follows:\n\n* `post` - All posts automatically get a `post` class.\n* `featured` - All posts marked as featured get the `featured` class.\n* `page` - Any static page gets the `page` class.\n* `tag-:slug` - For each tag associated with the post, the post get a tag in the format `tag-:slug`.\n\nFor example:\n\nA post which is not featured or a page, but has the tags `photo` and `panoramic` would get `post tag-photo tag-panoramic` as post classes.\n\nA featured post with a tag of `photo` would get `post tag-photo featured`.\n\nA featured page with a tag of `photo` and `panoramic` would get `post tag-photo tag-panoramic featured page`. \n\nSetting a post as featured or as a page can be done from the [post settings menu](http://support.ghost.org/post-settings-overview/#set-post-as-featured).\n\n### Example Code\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<article class=\\\"{{post_class}}\\\">\\n  {{content}}\\n</article>\",\n      \"language\": \"handlebars\"\n    },\n    {\n      \"code\": \"<article class=\\\"post tag-photo featured\\\">\\n    <p>Awesome post content</p>\\n</article>\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]","excerpt":"`{{post_class}}` Helper - Outputs dynamic CSS classes to identify a post","slug":"post_class","type":"basic","title":"post_class"}

post_class

`{{post_class}}` Helper - Outputs dynamic CSS classes to identify a post

[block:html] { "html": "<div class=\"github-deeplinks\">\n <a href=\"https://github.com/TryGhost/Ghost/blob/master/core/server/helpers/post_class.js\"><i class=\"fa fa-github-alt fa-right\"></i>Source</a>\n <a href=\"https://github.com/TryGhost/Ghost/blob/master/core/test/unit/server_helpers/post_class_spec.js\" class=\"fa fa-check-square-o fa-right\">Tests</a>\n</div>" } [/block] Usage: `{{post_class}}` [block:parameters] { "data": { "h-0": "Type", "h-1": "Parameters", "h-2": "Attributes", "0-0": "[Output](/docs/helpers#section-output), [Ghost](/docs/helpers#section-ghost)", "0-1": "n/a", "0-2": "n/a" }, "cols": 3, "rows": 1 } [/block] ### Description `{{post_class}}` – outputs classes intended for your post container, useful for targeting posts with styles. The classes are as follows: * `post` - All posts automatically get a `post` class. * `featured` - All posts marked as featured get the `featured` class. * `page` - Any static page gets the `page` class. * `tag-:slug` - For each tag associated with the post, the post get a tag in the format `tag-:slug`. For example: A post which is not featured or a page, but has the tags `photo` and `panoramic` would get `post tag-photo tag-panoramic` as post classes. A featured post with a tag of `photo` would get `post tag-photo featured`. A featured page with a tag of `photo` and `panoramic` would get `post tag-photo tag-panoramic featured page`. Setting a post as featured or as a page can be done from the [post settings menu](http://support.ghost.org/post-settings-overview/#set-post-as-featured). ### Example Code [block:code] { "codes": [ { "code": "<article class=\"{{post_class}}\">\n {{content}}\n</article>", "language": "handlebars" }, { "code": "<article class=\"post tag-photo featured\">\n <p>Awesome post content</p>\n</article>", "language": "text" } ] } [/block]