Software Design Blog

Journey of Rinat Abdullin

How to Export Blog From Wordpress to Squarespace

Professional weblog hosting has a lot of advantages compared to free hosting options or really flexible self-hosted solutions like Wordpress.

The most important one of them all - it is cheaper. Much cheaper. That’s because you do not have to waste your precious time installing and configuring plugins, tweaking design or doing back ups.

So recently (as motivated by a couple of hardware failures at my previous hoster) I’ve decided to give up on the Wordpress and move everything to the SquareSpace.com.

Here are some problems that I’ve encountered along the way and solutions to them.

A. Migrate Wordpress to Squarespace

The problems are:

  • tag archives are not supported by SquareSpace
  • importing resources (images, files etc) is not supported by the XML format
  • links break

Steps are:

  1. Export Wordpress blog to XML Format
  2. If you plan to do automated XML cleanup - fix ‘excerpt’ namespace (add namespace attribute - xmlns:excerpt=”http://purl.org/rss/1.0/modules/content/”)
  3. Search and replace all wp-content/uploads to storage/uploads (that’s where Squarespace will store our files)
  4. Rename all tags into categories (SS does not have tag archives):

    • category domain=”tag” -> category domain=”category”
    • rename tag declarations into category declarations (things like [wp:category][wp:category_nicename])
  5. Import the blog.

  6. Download the existing contents of your wp-content/uploads and archive every folder into zip
  7. Create uploads folder in the File Storage of Square Space and upload all the zip files (do not forget to click on “Decompress after upload)
  8. Delete old “Journal” Page
  9. Rename “Imported Data” into Journal and update the settings as needed
  10. Enable new Journal page, make it the first one and “Set as default”
  11. Redirect your domain to your blog.

B. Deal with forced HTML conversion

SquareSpace converts all non-HTML posts to HTML, thus breaking every post written in Textile or Markdown

For blogs with the large number of non-HTML posts it is unfeasible to import or fix every post manually.

And unfortunately the SquareSpace support claims that there is no other way except importing pre-converted HTML.

Well… here is my solution that could:

  1. Add Arhives page to you blog with the list of all posts
  2. Save HTML as Source and get the list of post URLs via the regex
  3. Launch VS 2008 and create Windows Forms application
  4. Drop the browser control window on top
  5. Code in the sequence:

    1. Navigate to your Squarespace blog
    2. Invoke “Universal SquareSpace Login” (the bookmarklet is available in the goodies section)
    3. Repeat for every link in your list:

      1. Navigate to it.
      2. Parse the HTML with a simple regex to find out the post ID
      3. Invoke the editor in a separate form (just open the url for Editor IFrame URL)
      4. Get the contents of “body” element and remove these html line breaks and other stuff.
      5. Post the containing form
  6. Sit back and watch the automation

C. Fixing Broken Links

No matter what you do, there still be broken links, since different blogs have different permalink structures.

There are two types of broken links, that matter:

  1. Links between the posts:

    • Just use regex+auto replace to match the urls of posts between each other (using the list of posts that you got from the Archives page)
    • Replace all the unmatched inner urls with the search queries
  2. External links:

    • determine the most popular incoming links by looking at your Google Analytics report (you do have it, do not you?)
    • Manually add url mappings in the SquareSpace control panel so that all popular incoming requests will be redirected to the new URLs.

D. Add syntax highlighting to SquareSpace

Squarespace does not have it. Period.

Solution:

  1. Download Prettify script (it powers Google Code, by the way)
  2. Upload stylesheet and javascript to your site
  3. Add HTML Widget to your sidebar with this script (update the file references to prettyfy.js and prettify.css as needed)

Now any block of code within [pre][code] will be highlighted by the script. Markdown code blocks are wrapped with these tags automatically.

E. Online CVV-only payments are not supported

Unfortunately these payments are widely used in Russia (Master and Visa). Support has suggested to ask the bank to let these transactions through. Well it could’ve worked if I were in Russia at the moment. Here’s another solution that worked for me:

  1. Upload USD to MoneyBookers (it supports all credit cards)
  2. Order a virtual Visa Card from Card444
  3. Use this credit card for the SquareSpace payment

Summary

Was this migration worth it?

Well:

  1. Existing weblog has been located on masterhost shared hosting plan that had extended round-trip to the major audience, some noticeable downtimes and they’ve lost a couple of my files during the last issue
  2. Handling your own Wordpress blog is fun and flexible, but is totally inefficient in the terms of TOC. Additionally the need to remember all the details about hosting, DNS, SEO, custom theme modifications etc.
  3. I have friendly support, reliable software and nice UI.

So the answer, so far, is yes.