So I'm moving my site from Squarespace to Middleman, a static website engine. Squarespace lets you export your content in a Wordpress-compatible XML file. I wrote this script to generate Middleman blog entries corresponding to published posts from the Squarespace exported XML file.
So what does it do? It finds all published text posts and reconfigures them for use with Middleman. All Squarespace-hosted images are downloaded to your computer and given unique names, and the img
tags in the posts themselves are updated. I also fix a few other things like Instagram and Vimeo embeds and added some bootstrap CSS classes to img
tags. It's pretty customized to my needs – not a general-purpose script.
Make sure Nokogiri is installed. Download, then chmod a+x
the script.rb
file, and run.
This worked for me – that does not mean it will work for you. I am not a ruby developer, so this code is probably really bad. I'm happy to answer questions on twitter.