Allow HB to access to user-defined parameters in a theme's package.json file


I’m just starting with ghost + digital ocean, so I’m not sure if my request makes sense.

I’d really love to have the opportunity to customise a theme using a single entry point, if possible the package.json file (or any another file assigned to this), whereby user-defined parameters are made accessible using variable helpers (such as @config). Example use case:

1- Say I want to have tags:tag0,tag1,… featured on the front page. The only option is to edit index.hbs, and hard code the value as a filter parameter.
2 - Instead, allow theme developers to provision a variable in mytheme/package.json, where:

  "config": {
    "posts_per_page": 10,

and provide access to that variable as HB using @config.tags_index, so that it can be reused in filter="{{@config.featured_tags}}".

Other example:

1- Say I want to test or change a subset of css assignments. One option is to directly alter the css file (screen.css), but that’s not adequate, as once those changes are made, it’s very difficult to keep track of them, and to roll them back.

2- Instead, using the same trick as above, the hbs and css code don’t change :

<h1 class="{{@config.my_css_title_h1}}">{{title}}</h1>

while package.json is updated from

  "config": {
    "posts_per_page": 10,


  "config": {
    "posts_per_page": 10,

Benefit: This allows to define a system base line (css + hbs files), and make alterations or test variations without changing it. In the current ghost development stage, one as to continuously make changes to multiple files, and the baseline is never stable. In case of a problem, it’s very tedious to go back to a known good state.

With the example above, once the baseline is defined, I can return to a known good state by changing two lines in package.json, while currently, I’d have to alter the css file, and the hbs files everywhere the featured_tags list is used.


I need this same exact feature. I saw a similar request closed on GitHub for some nonsensical reasons.

Ghost should open up the ability to add custom objects inside package.json, or some other standalone JSON file. There’s really no excuse not to.

@Kheo Have you considered using a version control system to create a “system baseline”?

For example you could use git and have a master branch with your current baseline, and then create branches, in which you can test out changes and new designs.

You can then either merge these changes into master when they’re ready, or not. But it will keep a history of all changes, with optional descriptions of what changed and why.

As for filtering by tag on the front page, I think our routing feature will support this use-case, which has docs here: Ghost Themes - Dynamic URLs & Routing

I hope this helps your workflow!