Variables on Ghost

Hi all,

What is the easiest way to set variables on Ghost? For example, I have an url that I often use in my posts but this url may change. Not to go through all the posts and manually update the url, I would prefer to have it defined in one place.

Is this doable? Sadly I haven’t found a straightforward solution, I would appreciate if you suggested a direction where to dig.

Thank you

Ghost doesn’t have arbitrary variables you can set, though I think there are other solutions to your problem.

You could try a link shortening service like https://short.io which allows you to change the target of a link, so you wouldn’t need to update your posts if the destination URL changes!

1 Like

It would be super nice, if that new Snippet functionality let you do just that.

You would be able to edit a Snippet and it would change in all the older articles/pages containing said snippet. That would be powerful! :slightly_smiling_face:

2 Likes

Hey!
With https://gaspr.io/ you can create a custom field and set a default value for that field. You then create a template to display your custom field. You add that template as an HTML card to any post where you want it to be displayed (one line of code). Gaspr will take care of rendering that field for you. If you need to update the link for any reason, Gaspr will refresh all the posts containing the template and field

PS: I have created this tool and would be glad to help you if you need any assistance

Here is the post with the solution…