Hugo

Hugo 101: Migrating images from services like Cloudinary

I am hosting on GitHub and thinking about hosting images somewhere else.

I am thinking to go with Cloudinary. What happens if in a few years I would decide that I have to migrate from Cloudinary to my own server or somewhere else?

How hard it is to migrate all the images?
How do you go about rewriting images URLs?

Keeping in mind I am not an advanced programmer – is this worth doing? Or is this a super complicated process and you would advise me to keep images inside the Hugo project?

Any pointers or other ideas on best practices for hosting images will be appreciated.

This is a decent Hugo topic, though I’d say it is something most site operators should consider, especially if they are all about visual stimuli.

My experience is from maintaining sites for orgs for long durations (over a decade), and making strategic hosting choices in field of technology choices. Here are some random tips:

  • Divide assets logically, thinking long-term. For NPOs we often have an archiving obligation for things like meeting minutes, whereas someone wants to upload every photo from every event to the blog. Those are two different buckets, and can be configured to make sense for their purpose (caching, storage, etc).
  • Choose a file layout, stick with it. If your files are consistent, paths and all, then it is relatively trivial to switch CDN or media assets URLs. A single redirect directive to a web server can handle a new domain.
  • Consider date-based assets, cache appropriately. Learned from a decade of dealing with WordPress sites that have the checkbox for “month-based folders” on uploads checked, and those those that do not. A single flat hierarchy isn’t as flexible as distinct, logical collections. How often do you go back to September, 2017 to edit the images uploaded then?

Cloudinary is a dope service, and I would not use it. I use Hugo because I follow the dream of the 90s, live in Portlandia, and serve static hypertext documents for public consumption. I expect folks to download the full assets I offer, once, and to be cached forever, per browser. I’m a system 2 web developer, and that extends to media prep. Cloudinary seems great for not having to deal with media, just upload and forget.

Cloudinary’s functionalities, those are things I would not count on being available in the future.

Good thinking about your exit strategy, by the way. That’s how I evaluate a service: what happens when I move away? :slight_smile:

1 Like

Thanks for the awesome answer! I think I am looking for similar approach. It’s super-valuable to get this advice from somebody a lot more advanced in front-end.
Some follow up questions:

Can you talk in ELI5 how a simple transfer from service like Cloudinary would look like?

So let’s say my blog would have 150 posts and 100 images per year. Because of some special functionality – I was planning to keep content in one flat folder with a sub-folder for images (no Hugo sections). Would you advise me to reconsider doing content/2019 or even content/2019/January?

P.S. :wave: from Seattle, might be moving to Portlandia in the fall