Lesson learned - back up those code injections!

I’m posting this here in case it saves someone else from some heartburn.

My site is hosted by one of the various Ghost hosting companies out there. This particular host does not allow FTP access to the back end, so I depend on the host for upgrades and backups.

Yesterday, something munged my site. Not sure what; perhaps an upgrade gone awry. Didn’t matter; I needed to dig in and see what was up.

I wasn’t too worried; after all, I have the theme file on my computer, with all the various changes I’ve made to it over the past year. And, I export my posts locally as well, so I could do a complete refresh if I absolutely had to.

After some more digging, I realized that all the code injections were gone, in both header and footer. And then it hit me: I did not have a backup of the code injections.

After much gnashing of teeth, I located an earlier version of the site on the Wayback Machine, and was able to recreate the code injections from there. (I also recreated the navigation, which was also gone.)

Short moral of this tale of woe: Back up your code injections along the way!

And staff: It might be nice if the “Download theme” was adjusted to “Download theme and code injections.”

2 Likes

Code Injection is considered a setting (similar to e.g. Site Title), and is included in a content export. So if you have a backup of your posts, you have a backup of your code injection!

1 Like

sorry about your woes. @vikaspotluri123 is right on the money that Code Injections would be part of a content export, so that might be able to help you.

If not, you could also see if you’re site is on the Wayback Machine → Internet Archive: Wayback Machine

If so, you can copy the code from your site head and body.

Is there a “content export” for Ghost Pro users? Thanks.

Yep, here’s the documentation for both self-hosted and managed: Imports and exports in Ghost: Access your content and data - FAQ

Thanks so much; just what I was looking for. I hadn’t looked at Labs. I appreciate your help.