{"category":{"version":"58c81e8e693cdd1900606acf","project":"542fe92a5eceb608003fddc8","_id":"58c81e8e693cdd1900606ad1","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-05-13T19:08:44.260Z","from_sync":false,"order":1,"slug":"context-reference","title":"Context 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":"58c81e8f693cdd1900606b08","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-05-13T19:09:34.489Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":10,"body":"Use: `{{#is \"post\"}}{{/is}}` to detect this context.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Context\",\n    \"h-1\": \"Url\",\n    \"h-2\": \"Template\",\n    \"h-3\": \"Data\",\n    \"h-4\": \"Body Classes\",\n    \"0-0\": \"post\",\n    \"0-1\": \"/:permalink/\",\n    \"0-2\": \"post.hbs\",\n    \"0-3\": \"{post}\",\n    \"0-4\": \".post-template, .tag-:slug\"\n  },\n  \"cols\": 5,\n  \"rows\": 1\n}\n[/block]\n## Description\n\nWhenever you're viewing a single blog post, you're in the `post` context. The `post` context is not set on static pages, which uses the [page context](doc:page-context) instead.\n\n## Routes\n\nThe URL used to render a single post is configurable in the Ghost admin. The default is `/:slug/`. Ghost also has an option for date-based permalinks, and can support many other formats if the setting is edited in the database (UI coming soon).\n\n## Templates\n\nThe post context always uses the `post.hbs` template. This template is required in all Ghost themes. At present there is no support for custom post templates as there is for pages.\n\n## Data\n\nThe `post` context provides access to the post object which matches the route. As with all contexts, all of the `:::at:::blog` global data is also available. \n\nWhen outputting the post, you can use a block expression (`{{#post}}{{/post}}`) to drop into the post scope and access all of the attributes. See a full list of attributes below:\n\n### Post object attributes\n\n- **id** - the incremental ID of the post  \n- **title** - the title of your blog post ([title helper](doc:title))\n- **slug** - slugified version of the title (used in urls and also useful for class names)\n- **excerpt** - a short preview of your post content ([excerpt helper](doc:excerpt))\n- **content** - the content of the post ([content helper](content))\n- **url** - the web address for the post page ([url helper](doc:url))\n- **image** - the cover image associated with the post  ([image helper](doc:image))\n- **featured** - indicates a featured post. Defaults to `false`  \n- **page** `true` if the post is a page. Defaults to `false`\n- **meta_title** - custom meta title for the post ([meta_title helper](doc:meta_title))\n- **meta_description**  Custom meta description for the post ([meta_description helper](doc:meta_description) )\n- **published_at:** date and time when the post was published  ([date helper](doc:date))\n- **updated_at:** date and time when the post was last updated  ([date helper](doc:date))\n- **created_at:** date and time when the post was created  ([date helper](doc:date))\n-  **author** - full details of the post's author (see [author](doc:author) for details)\n- **tags** - a list of tags associated with the post (see [tags](doc:tags) for details)\n\n## Helpers\n\nUsing the `{{#post}}{{/post}}` block expression is the key trick to having a happy time theming your post page. Once inside of the post, you can use any of these useful helpers (and many more) to output your post's data:\n\n[{{title}}](doc:title), [{{content}}](doc:content), [{{url}}](doc:url), [{{author}}](doc:author), [{{date}}](doc:date), [{{excerpt}}](doc:excerpt), [{{image}}](doc:image), [{{post_class}}](doc:post_class), [{{tags}}](doc:tags)\n\n## Example code\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<!-- Everything inside the #post tags pulls data from the post -->\\n{{#post}}\\n              \\n<article class=\\\"{{post_class}}\\\">\\n  <header class=\\\"post-header\\\">\\n    <h1 class=\\\"post-title\\\">{{title}}</h1>\\n    <section class=\\\"post-meta\\\">\\n      <time class=\\\"post-date\\\" datetime=\\\"{{date format='YYYY-MM-DD'}}\\\">\\n        {{date format=\\\"DD MMMM YYYY\\\"}}\\n      </time> \\n      {{tags prefix=\\\" on \\\"}}\\n    </section>  \\n  </header>\\n  <section class=\\\"post-content\\\">\\n    {{content}}\\n  </section>     \\n</article>\\n\\n{{/post}}      \",\n      \"language\": \"html\",\n      \"name\": \"post.hbs\"\n    }\n  ]\n}\n[/block]","excerpt":"The `post` context","slug":"post-context","type":"basic","title":"post"}

post

The `post` context

Use: `{{#is "post"}}{{/is}}` to detect this context. [block:parameters] { "data": { "h-0": "Context", "h-1": "Url", "h-2": "Template", "h-3": "Data", "h-4": "Body Classes", "0-0": "post", "0-1": "/:permalink/", "0-2": "post.hbs", "0-3": "{post}", "0-4": ".post-template, .tag-:slug" }, "cols": 5, "rows": 1 } [/block] ## Description Whenever you're viewing a single blog post, you're in the `post` context. The `post` context is not set on static pages, which uses the [page context](doc:page-context) instead. ## Routes The URL used to render a single post is configurable in the Ghost admin. The default is `/:slug/`. Ghost also has an option for date-based permalinks, and can support many other formats if the setting is edited in the database (UI coming soon). ## Templates The post context always uses the `post.hbs` template. This template is required in all Ghost themes. At present there is no support for custom post templates as there is for pages. ## Data The `post` context provides access to the post object which matches the route. As with all contexts, all of the `@blog` global data is also available. When outputting the post, you can use a block expression (`{{#post}}{{/post}}`) to drop into the post scope and access all of the attributes. See a full list of attributes below: ### Post object attributes - **id** - the incremental ID of the post - **title** - the title of your blog post ([title helper](doc:title)) - **slug** - slugified version of the title (used in urls and also useful for class names) - **excerpt** - a short preview of your post content ([excerpt helper](doc:excerpt)) - **content** - the content of the post ([content helper](content)) - **url** - the web address for the post page ([url helper](doc:url)) - **image** - the cover image associated with the post ([image helper](doc:image)) - **featured** - indicates a featured post. Defaults to `false` - **page** `true` if the post is a page. Defaults to `false` - **meta_title** - custom meta title for the post ([meta_title helper](doc:meta_title)) - **meta_description** Custom meta description for the post ([meta_description helper](doc:meta_description) ) - **published_at:** date and time when the post was published ([date helper](doc:date)) - **updated_at:** date and time when the post was last updated ([date helper](doc:date)) - **created_at:** date and time when the post was created ([date helper](doc:date)) - **author** - full details of the post's author (see [author](doc:author) for details) - **tags** - a list of tags associated with the post (see [tags](doc:tags) for details) ## Helpers Using the `{{#post}}{{/post}}` block expression is the key trick to having a happy time theming your post page. Once inside of the post, you can use any of these useful helpers (and many more) to output your post's data: [{{title}}](doc:title), [{{content}}](doc:content), [{{url}}](doc:url), [{{author}}](doc:author), [{{date}}](doc:date), [{{excerpt}}](doc:excerpt), [{{image}}](doc:image), [{{post_class}}](doc:post_class), [{{tags}}](doc:tags) ## Example code [block:code] { "codes": [ { "code": "<!-- Everything inside the #post tags pulls data from the post -->\n{{#post}}\n \n<article class=\"{{post_class}}\">\n <header class=\"post-header\">\n <h1 class=\"post-title\">{{title}}</h1>\n <section class=\"post-meta\">\n <time class=\"post-date\" datetime=\"{{date format='YYYY-MM-DD'}}\">\n {{date format=\"DD MMMM YYYY\"}}\n </time> \n {{tags prefix=\" on \"}}\n </section> \n </header>\n <section class=\"post-content\">\n {{content}}\n </section> \n</article>\n\n{{/post}} ", "language": "html", "name": "post.hbs" } ] } [/block]