Point local asset path to a Ghost pro site?

I have a Ghost Pro site with lots of content, but I want to set up a local instance so I can create some custom views. I exported the content from Pro and imported it locally, but of course the glaring omission is all of the photos, so it’s really hard to preview the site as it will actually be once I upload the theme.

Ideally I’d like to just point the image paths to the production site (hotlink) for development purposes. I found I can insert the prod url directly before {{img_url}} tags in the hbs templates and it does the job. Example

srcset="https://path-to-site.ghost.io{{img_url feature_image...

But ideally there’s one place to update the img_url tag as a whole, to prepend it with the site URL. Is there a way to do this? (I tried updating the url in config.development.json but that predictably did not work.)


Hey @watilo,

Out of the box handlebars doesn’t support the creation of variables out of the box. Unless that’s not exactly what you’re asking for?

Are you using your own install of Ghost in production as well as locally? Have you looked into using Ghost as a headless CMS? This may give you more flexibility as a developer.

I know you’re developing locally, so it’s not as feasible, but when I had the problem a few months ago, I used nginx to proxy all requests to /content to the Ghost (Pro) instance, and all other requests to the development Ghost instance.

It’s quite easy to setup nginx on MacOS + Brew, and nginx has limited (but should be enough) Windows support.

That’s a nice idea! Didn’t think of that

1 Like