The Ghost Themes Developer Hub

Welcome to the Ghost Themes developer hub. You'll find comprehensive guides and documentation to help you start working with Ghost Themes as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

@config

@config Helper - Global config data

The @config property provides access to global data properties, which are available anywhere in your theme.

Specifically @config will pass through the special theme config that is added in the theme's package.json so that it can be used anywhere in handlebars.

At the moment, there is only one property which will be passed through:

  • {{@config.posts_per_page}} – the number of posts per page

Example Code

{{#get "posts" filter="featured:true" limit="{{@config.posts_per_page}}"}}
  {{#foreach posts}}
      <h1>{{title}}</h1>
	{{/foreach}}
{{/get}}

Providing config

Config values can be provided by adding a config block to package.json

E.g.

{
  "name": "my-theme",
  "version": 1.0.0,
  "author": {
    "email": "[email protected]"
  }
  "config": {
  }
}

Inside of the config block, there is currently a single supported property - posts_per_page.

{
  "name": "my-theme",
  "version": 1.0.0,
  "author": {
    "email": "[email protected]"
  }
  "config": {
    "posts_per_page": 10
  }
}

More coming soon...

I guess it's obvious, but we expect to add more config properties soon. If you have ideas please submit them to https://ideas.ghost.org

@config

@config Helper - Global config data