5 Things You Need To Know Before You Migrate From WordPress To A Static Site

In my previous post on moving away from WordPress things have progressed somewhat smoothly. However, when you’re jumping into the deep unknown you don’t know what’s a normal pain point, or what is a worry.

I’d like to share a few issues I encountered that you might want to consider if you too are considering when going static.

Here are five such issues:

1. Comments

If your WordPress install has comments enabled, and comments are a big thing on your website, then depending upon how you’ve managed this you may need to do a little more research on how to successfully extract them from the WordPress database.

Thankfully I’ve had my comments enabled with a free online service called Disqus. The only aspect I needed to be wary of with this transition was breaking comments on posts, but Disqus has your back with this insightful post on mapping comments to a new structure.

So the complexity of migrating comments wasn’t really a complexity at all – but may certainly be for your site. Do your research to see if it ends up being a problem.

2. Permalink Structure & Redirects

WordPress has a unique way of managing URL’s within your site. If you have itchy fingers you may have changed the permalink structure of your WordPress website many times over its lifetime. Thankfully WordPress does an awesome job in being able to route old permalink structures to new ones, and it does this by maintaining a simple ID for every post and page. Therefore, regardless of whatever you change for the permalink address on your website you will be referenced to the correct page.

What makes this difficult though is when you bring this complicated permalink structure over to a static site. My personal websites all maintain the same permalink structure of /%post_id%/%postname%/, but there was a time where I used to have this structure: /%year%/%monthnum%/%day%/%postname%/.

I have found creating the permalink for each post and page not too difficult (at least in my case), but you will need to note down the permalink structure you have used as this will be needed to redirect pages on your website to new ones should you want to.

3. Redirects

The other minor issue here is if you have permalinks within your WordPress site that redirect to another web page. When migrating over to a static service you may still want to retain the redirects and therefore you will need to find a way of creating an HTML page which redirects to another.

4. How To Get Your Uploaded Files

WordPress keeps all your uploads in one nice little folder for easy navigation and ease of use. You’ll need to be able to gain access to this folder if you want to be able to move your existing content to a new static site.

If you can’t, I would suggest you read up on how to use the wget command from within a Unix box to help you extract your website into a static site.

wget Command

I’ve found the following command to work with my sites, but you might like to do some more reading here.

wget -m --random-wait -p --html-extension -k -E robots=off -nc -P mysite http://www.mysite.com

Or with the more detailed flags is:

wget --mirror --random-wait --page-requisites --html-extension --convert-links --execute robots=off --no-clobber --directory-prefix=mysite http://www.my-site.com/

With each flag interpreted means:

  • --mirror Turn on options suitable for mirroring. This option turns on recursion and time-stamping, sets infinite recursion depth and keeps FTP directory listings.
  • --random-wait Helps the server so that it doesn’t get clobbered with so many requests. Generally waits between 500 and 1500 milliseconds.
  • --page-requisites This option causes Wget to download all the files that are necessary to properly display a given HTML page. This includes such things as inline images, sounds, and referenced stylesheets.
  • --html-extension Convert the downloaded page to have a .HTML extension.
  • --convert-links Convert links to relative referencing for local viewing.
  • --execute robots=off The command after this parameter will execute. Here we have robots=off which you would only ever do when running on your own WordPress installs because then you will know what has been downloaded.
  • --no-clobber If a file has already been downloaded, don’t download it again.
  • --directory-prefix=mysite Save to the directory within the folder where this command is run and name the folder mysite.
  • http://www.my-site.com/ The URI of your website.

Give your terminal a few minutes to spider through your site and download all your content and when you do you should be able to open up the folder within your mysite folder and navigate to your wp-contents folder and see which files your WordPress media library uses.

You may even prefer to use this than your actual FTP download of your wp-contents folder or perhaps maintain both just to check that the correct files uses the proper references.

After running the wget command you should now be in a position where you already have a static version of your site (thanks to the power of wget), and this may be all you really need, but as I’m looking beyond just converting a WordPress site ONCE to a static site and looking to maintain the site with future updates and posts (etc) I need to keep going.

5. HTML/CSS Design

This is perhaps the biggest complexity for my sites and one which will take the majority of development time. Unfortunately one of the biggest problems I have with some of my WordPress installs is that they have a dozen or so plugins installed all of which love inserting their own meta tags and bloating up my HTML output pages. Now I’m in a position of being able to move to an HTML template of my own design it means that I’ll be leaving a lot of the current structure behind.

This means that there will need to be new development in my new sites with the way they are structured, and the way the CSS then merges with this new structure. Therefore, my current WordPress CSS files become somewhat useless, and the money spent on buying themes and enhancing their structure now becomes obsolete.

Keep this in mind as ponder on whether this cost will be too much for you to throw away. Some WordPress installs have spent a lot of money on plugins and themes and find that by throwing it all away would be a waste of money. If this is your case then maybe look at some aspects that attract you to going static and try to determine if there are ways of tweaking your WordPress installs to fit what you are looking for in your sites.

As I’m fairly confident with my CSS and HTML skills I don’t mind spending a few days coding my sites into a new CSS structure.

Hidden Costs

If you’ve been using WordPress for quite some time, as I did for over a decade, then there would have been purchases made on themes and plugins. If you do make the move away from WordPress it means these costs have become sunk.

You may want to consider how long it will take to recoup these costs by comparing the cost of going static with the current costs you have incurred with your current hosting setup.

Weigh up whether the cost is worth it and be also mindful there’s a time cost incurred when bringing everything across. If you don’t have the time it may not be worth it, but if you have a spare weekend then it might be enough to devote that time to the transition.

Finally, are you confident enough to support the transition? If you’re not confident with DNS in connecting to your sites, and working with the command line to generate your static sites then the time spent on development would be more substantial.

Conclusion

Anyway, there are probably a few more complexities that need to be considered that I haven’t yet thought about, however, these have been the main ones. Therefore, before moving over to static consider the following:

  • How am I going to retain/manage comments?
  • Will I need to employ a complex redirect/permalink structure? Can the static service or software maintain this?
  • Can you get your uploaded files? Can you get them easily enough?
  • Will it be easy to port over your HTML & CSS? Do you rely on themes and plugins and do they insert HTML?
  • Consider the cost of investment you have made with WordPress themes and plugins? Consider also the time cost needed in the transition?
  • Are you confident with handling DNS errors, and the command line in generating your static site?

Hopefully these questions will help you to think more deeply about your transition away. Obviously WordPress has been a popular choice for many people with their websites because the costs and pain points raised from these questions is more burdensome than their alternative.