How to add a global variable when develop a Ghost theme


I want to define a string in global variable, such as “slug:[xx0,xx1]”.
because I want to reuse it in different pages. and it can be more maintainable.

sorry for my English



This isn’t really possible, but you can kind of hack a couple of global variables by repurposing other fields.

For example, create a an author called data - you can now use the get helper, wherever you want to access that variable, which can be updated via admin.

eg. here I’ve used the author.location field to store a custom string:

{{#get "authors" filter="slug:data" as |data|}}
  {{#foreach data}}

closed #3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.