{"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":"58c81e8f693cdd1900606b09","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-05-13T20:16:53.456Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":11,"body":"Use: `{{#is \"page\"}}{{/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\": \"page\",\n    \"0-1\": \"/:slug/\",\n    \"0-2\": \"page-:slug.hbs, page.hbs, post.hbs\",\n    \"0-4\": \".page-template, .tag-:slug\",\n    \"0-3\": \"{post}\"\n  },\n  \"cols\": 5,\n  \"rows\": 1\n}\n[/block]\n## Description\n\nWhenever you're viewing a static page, you're in the `page` context. The `page` context is not set on posts, which uses the [post context](doc:post-context) instead.\n\n## Routes\n\nThe URL used to render a static page is always `/:slug/`. This cannot be customised, unlike post permalinks.\n\n## Templates\n\nThe default template for a page is `post.hbs`. \n\nYou can optionally include a `page.hbs` file in your theme which will be used for pages instead. \n\nAdditionally, you can provide a custom template for a specific page. If there is a `page-:slug.hbs` file with the `:slug` matching the static page's slug this will be used instead. \n\nFor example, if you have an 'About' page with the url `/about/`, adding a template called `page-about.hbs` will cause that template to be used for the about page, instead of page.hbs, or post.hbs.\n\nThese templates exist in a hierarchy. Ghost looks for a template which matches the slug (`page-:slug.hbs`) first, then looks for `page.hbs` and finally uses `post.hbs` if neither is available.\n\n## Data\n\nThe `page` context provides access to the post object which matches the route. A page is just a special type of post, so the data object is called a post, not a page. As with all contexts, all of the `:::at:::blog` global data is also available. \n\nWhen outputting the page, you can use a block expression (`{{#post}}{{/post}}`) to drop into the post scope and access all of the attributes. All of the data available for a page is the same as the data for a post. See a full list of attributes below:\n\n### Post (page) object attributes\n\n- **id** - the incremental ID of the page  \n- **title** - the title of your static page ([title helper](doc:title))\n- **excerpt** - a short preview of your page content ([excerpt helper](doc:excerpt))\n- **content** - the content of the page ([content helper](content))\n- **url** - the web address for the static page ([url helper](doc:url))\n- **image** - the cover image associated with the page  ([image helper](doc:image))\n- **featured** - indicates a featured page. Defaults to `false`  \n- **page** - `true` if the post is a static page. Defaults to `false`\n- **meta_title** - custom meta title for the page ([meta_title helper](doc:meta_title))\n- **meta_description**  -Custom meta description for the page ([meta_description helper](doc:meta_description) )\n- **published_at:** - date and time when the page was published  ([date helper](doc:date))\n- **updated_at:** - date and time when the page was last updated  ([date helper](doc:date))\n- **created_at:** - date and time when the page was created  ([date helper](doc:date))\n-  **author** - full details of the page's author (see [author](doc:author) for details)\n- **tags** - a list of tags associated with the page (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 static page. Once inside of the page, you can use any of these useful helpers (and many more) to output your page'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 static page -->\\n{{#post}}\\n              \\n<article class=\\\"{{post_class}}\\\">\\n  <header class=\\\"page-header\\\">\\n    <h1 class=\\\"page-title\\\">{{title}}</h1>\\n    <section class=\\\"page-meta\\\">\\n      <time class=\\\"page-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=\\\"page-content\\\">\\n    {{content}}\\n  </section>     \\n</article>\\n\\n{{/post}}      \",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]","excerpt":"The `page` context","slug":"page-context","type":"basic","title":"page"}

page

The `page` context

Use: `{{#is "page"}}{{/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": "page", "0-1": "/:slug/", "0-2": "page-:slug.hbs, page.hbs, post.hbs", "0-4": ".page-template, .tag-:slug", "0-3": "{post}" }, "cols": 5, "rows": 1 } [/block] ## Description Whenever you're viewing a static page, you're in the `page` context. The `page` context is not set on posts, which uses the [post context](doc:post-context) instead. ## Routes The URL used to render a static page is always `/:slug/`. This cannot be customised, unlike post permalinks. ## Templates The default template for a page is `post.hbs`. You can optionally include a `page.hbs` file in your theme which will be used for pages instead. Additionally, you can provide a custom template for a specific page. If there is a `page-:slug.hbs` file with the `:slug` matching the static page's slug this will be used instead. For example, if you have an 'About' page with the url `/about/`, adding a template called `page-about.hbs` will cause that template to be used for the about page, instead of page.hbs, or post.hbs. These templates exist in a hierarchy. Ghost looks for a template which matches the slug (`page-:slug.hbs`) first, then looks for `page.hbs` and finally uses `post.hbs` if neither is available. ## Data The `page` context provides access to the post object which matches the route. A page is just a special type of post, so the data object is called a post, not a page. As with all contexts, all of the `@blog` global data is also available. When outputting the page, you can use a block expression (`{{#post}}{{/post}}`) to drop into the post scope and access all of the attributes. All of the data available for a page is the same as the data for a post. See a full list of attributes below: ### Post (page) object attributes - **id** - the incremental ID of the page - **title** - the title of your static page ([title helper](doc:title)) - **excerpt** - a short preview of your page content ([excerpt helper](doc:excerpt)) - **content** - the content of the page ([content helper](content)) - **url** - the web address for the static page ([url helper](doc:url)) - **image** - the cover image associated with the page ([image helper](doc:image)) - **featured** - indicates a featured page. Defaults to `false` - **page** - `true` if the post is a static page. Defaults to `false` - **meta_title** - custom meta title for the page ([meta_title helper](doc:meta_title)) - **meta_description** -Custom meta description for the page ([meta_description helper](doc:meta_description) ) - **published_at:** - date and time when the page was published ([date helper](doc:date)) - **updated_at:** - date and time when the page was last updated ([date helper](doc:date)) - **created_at:** - date and time when the page was created ([date helper](doc:date)) - **author** - full details of the page's author (see [author](doc:author) for details) - **tags** - a list of tags associated with the page (see [tags](doc:tags) for details) - ## Helpers Using the `{{#post}}{{/post}}` block expression is the key trick to having a happy time theming your static page. Once inside of the page, you can use any of these useful helpers (and many more) to output your page'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 static page -->\n{{#post}}\n \n<article class=\"{{post_class}}\">\n <header class=\"page-header\">\n <h1 class=\"page-title\">{{title}}</h1>\n <section class=\"page-meta\">\n <time class=\"page-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=\"page-content\">\n {{content}}\n </section> \n</article>\n\n{{/post}} ", "language": "text" } ] } [/block]