Cleaning up image links after wordpress migration

I have succesfully migrated a wordpress site to hugo and now add new content normally. I cleaned manually any of the migrated pages that got mangled markup.

One thing that is simply to much to do manually is cleaning the image links. They do work (there is a link to the right file), but they are an unreadable mess, with all sorts of different attributes (e.g alternate image sizes) that are no longer functional.

Anybody has been in the same spot and found a smart way to do this? Some script to find, parse and replace these relic constructs by simple markup (but which wouldnt take more time to write than going one by one through all images.)

this strikes me as a job for regexp in bash/zsh/fish script, not hugo (whose regexp capabilities pale)

1 Like