{"category":{"version":"58c81e8e693cdd1900606acf","project":"542fe92a5eceb608003fddc8","_id":"58c81e8e693cdd1900606ad0","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-04T12:33:46.255Z","from_sync":false,"order":0,"slug":"documentation","title":"Documentation"},"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":"58c81e8e693cdd1900606ad9","__v":0,"updates":["5512ac45db5369190008730c","557714b5e6063e0d00481319","55a091555730f40d0011052d","55b194b5b3a7e037008ac2e1","55e85a95315c421700d43ae7"],"next":{"pages":[],"description":""},"createdAt":"2014-10-04T15:58:51.897Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"never","params":[],"url":""},"isReference":false,"order":3,"body":"The recommended file structure is:\n\n```\n.\n├── /assets\n|   └── /css\n|       ├── screen.css\n|   ├── /fonts\n|   ├── /images\n|   ├── /js\n├── default.hbs \n├── index.hbs [required]\n└── post.hbs [required]\n└── package.json [required]\n```\n\nFor the time being there is no requirement that `default.hbs` or any folders exist. \n\nIf you use assets, it is required that you keep them inside of an `assets` folder, and make use of the [`{{asset}}` helper](doc:asset) for serving css, js, image, font and other asset files. Without this, your theme may suffer from caching issues when updated.\n\nIt is also required that you make use of the `{{ghost_head}}` and `{{ghost_foot}}` helpers.\n\n`index.hbs`and `post.hbs` are required – Ghost will not work if these two templates are not present.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"While edits to existing handlebars, js and css files are handled & updated on the fly when in development mode, you will need to restart Ghost each time you add or remove a file from the theme directory for it to be recognised and used.\",\n  \"title\": \"Note on file changes\"\n}\n[/block]\n### Partials\n\nYou can also optionally add a `/partials` directory to your theme. This should include any part templates you want to use across your blog, for example `list-post.hbs` might include your template for outputting a single post in a list, which might then be used on the homepage, author & tag pages. To output the `list-post.hbs` example you would use `{{> list-post}}`.\n\n```\n.\n├── /assets\n    ├── /css\n        ├── screen.css\n    ├── /fonts\n    ├── /images\n    ├── /js\n├── /partials\n    ├── list-post.hbs\n├── default.hbs\n├── index.hbs [required]\n└── post.hbs [required]\n└── package.json [required]\n```\n\nThe `/partials` directory is also where you can put templates to override the built-in templates used by certain helpers like pagination & navigation. Including a `pagination.hbs` file inside `partials` will let you specify your own HTML for pagination, and likewise with `navigation.hbs`. Note that these partials *must* be included using their helpers `{{pagination}}` and `{{navigation}}` and *not* using the partial syntax.\n\n### Layouts\n\nUsing a `default.hbs` file as a default layout for all templates is highly recommended. You can extend the `default.hbs` file in any other file using the layout syntax: `{{!< default}}`. It is possible to specify multiple layouts, and also to nest layouts.\n\n## Templates\n\n---\n\nAlthough partials can be custom with names of your choice, the templates used in a Ghost theme must follow strict naming conventions. Each template is used to render a specific page or section of a blog (called a [Context](doc:context-overview), and each template gets given access to specific data. See the page on [Templates](doc:templates) for more information about the templates, or use this quick-list to reference the template you'd like more information about:\n\n* [index.hbs](/docs/templates#section-index-hbs)\n* [home.hbs](/docs/templates#section-home-hbs)\n* [post.hbs](/docs/templates#section-post-hbs)\n* [page.hbs](/docs/templates#section-page-hbs), [page-{{slug}}.hbs](/docs/templates#section-page-hbs)\n* [tag.hbs](/docs/templates#section-tag-hbs), [tag-{{slug}}.hbs](/docs/templates#section-tag-hbs)\n* [author.hbs](/docs/templates#section-author-hbs), [author-{{slug}}.hbs](/docs/templates#section-tag-hbs)\n* [private.hbs](/docs/templates#section-private-hbs)\n* [error.hbs](/docs/templates#section-error-hbs)\n* [amp.hbs](doc:amp)\n\n\n## Helpers\n\n---\n\nGhost templates are constructed from HTML and Handlebars. For an overview of how the Handlebars templating language works, please see the [Handlebars](doc:handlebars) section. The [Helper Reference](doc:helpers) covers all of the native and custom Handlebars helpers available in Ghost and how to use them.\n\n## Contexts\n\n---\n\nEach page in a Ghost theme belongs to a context. The context can be determined by the URL, and tells you which template will be used, what data will be available and what will be output by the [`{{body_class}}`](doc:body_class) helper. Below is a quick list of all context. For more details see the [context table](/docs/context-overview#section-context-table), in the [Context Reference](doc:context-overview).\n\n* [index](doc:index-context) \n* [home](doc:home-context) \n* [post](doc:post-context) \n* [page](doc:page-context) \n* [tag](doc:tag-context) \n* [author](doc:author-context) \n* [paged](doc:paged-context) \n* [private](doc:private-context)\n* [subscribe](doc:subscribe)\n* [amp](doc:amp-context)","excerpt":"Overview of Ghost theme structure","slug":"structure","type":"basic","title":"Structure"}

Structure

Overview of Ghost theme structure

The recommended file structure is: ``` . ├── /assets | └── /css | ├── screen.css | ├── /fonts | ├── /images | ├── /js ├── default.hbs ├── index.hbs [required] └── post.hbs [required] └── package.json [required] ``` For the time being there is no requirement that `default.hbs` or any folders exist. If you use assets, it is required that you keep them inside of an `assets` folder, and make use of the [`{{asset}}` helper](doc:asset) for serving css, js, image, font and other asset files. Without this, your theme may suffer from caching issues when updated. It is also required that you make use of the `{{ghost_head}}` and `{{ghost_foot}}` helpers. `index.hbs`and `post.hbs` are required – Ghost will not work if these two templates are not present. [block:callout] { "type": "info", "body": "While edits to existing handlebars, js and css files are handled & updated on the fly when in development mode, you will need to restart Ghost each time you add or remove a file from the theme directory for it to be recognised and used.", "title": "Note on file changes" } [/block] ### Partials You can also optionally add a `/partials` directory to your theme. This should include any part templates you want to use across your blog, for example `list-post.hbs` might include your template for outputting a single post in a list, which might then be used on the homepage, author & tag pages. To output the `list-post.hbs` example you would use `{{> list-post}}`. ``` . ├── /assets ├── /css ├── screen.css ├── /fonts ├── /images ├── /js ├── /partials ├── list-post.hbs ├── default.hbs ├── index.hbs [required] └── post.hbs [required] └── package.json [required] ``` The `/partials` directory is also where you can put templates to override the built-in templates used by certain helpers like pagination & navigation. Including a `pagination.hbs` file inside `partials` will let you specify your own HTML for pagination, and likewise with `navigation.hbs`. Note that these partials *must* be included using their helpers `{{pagination}}` and `{{navigation}}` and *not* using the partial syntax. ### Layouts Using a `default.hbs` file as a default layout for all templates is highly recommended. You can extend the `default.hbs` file in any other file using the layout syntax: `{{!< default}}`. It is possible to specify multiple layouts, and also to nest layouts. ## Templates --- Although partials can be custom with names of your choice, the templates used in a Ghost theme must follow strict naming conventions. Each template is used to render a specific page or section of a blog (called a [Context](doc:context-overview), and each template gets given access to specific data. See the page on [Templates](doc:templates) for more information about the templates, or use this quick-list to reference the template you'd like more information about: * [index.hbs](/docs/templates#section-index-hbs) * [home.hbs](/docs/templates#section-home-hbs) * [post.hbs](/docs/templates#section-post-hbs) * [page.hbs](/docs/templates#section-page-hbs), [page-{{slug}}.hbs](/docs/templates#section-page-hbs) * [tag.hbs](/docs/templates#section-tag-hbs), [tag-{{slug}}.hbs](/docs/templates#section-tag-hbs) * [author.hbs](/docs/templates#section-author-hbs), [author-{{slug}}.hbs](/docs/templates#section-tag-hbs) * [private.hbs](/docs/templates#section-private-hbs) * [error.hbs](/docs/templates#section-error-hbs) * [amp.hbs](doc:amp) ## Helpers --- Ghost templates are constructed from HTML and Handlebars. For an overview of how the Handlebars templating language works, please see the [Handlebars](doc:handlebars) section. The [Helper Reference](doc:helpers) covers all of the native and custom Handlebars helpers available in Ghost and how to use them. ## Contexts --- Each page in a Ghost theme belongs to a context. The context can be determined by the URL, and tells you which template will be used, what data will be available and what will be output by the [`{{body_class}}`](doc:body_class) helper. Below is a quick list of all context. For more details see the [context table](/docs/context-overview#section-context-table), in the [Context Reference](doc:context-overview). * [index](doc:index-context) * [home](doc:home-context) * [post](doc:post-context) * [page](doc:page-context) * [tag](doc:tag-context) * [author](doc:author-context) * [paged](doc:paged-context) * [private](doc:private-context) * [subscribe](doc:subscribe) * [amp](doc:amp-context)