I have finally decided that WordPress is not exactly what I want for my blog. I was also excited about the possibility of hosting my site without the dependencies on the database server, PHP engine etc. At the end, the blog is mostly static, the pages change only when I change them. And the comments can be handled by other services. Last, but not the least, I love Amazon Web Services, their offering of paying for what you actually use. I think their services are flexible enough to satisfy both small home users and large enterprise ones.

Also I think that if you want to concentrate on the content, you probably do not care too much about the layout. In this case Markdown is just right for your needs. And it does not restrict you if you want to practice some advanced HTML anyway. WordPress does offer the visual editor for the posts but I actually never used it and always preferred to write an HTML post in VIM instead.

Here is what inspired me to do the move:

I used to host my WordPress blog with GoDaddy. By the way, I do like GoDaddy's service, I think it is very rich, reasonably priced and simple to use. So I will continue to host my domains there for a while. Even if at any time you think their price is too high, you can find a 15-30% rebate coupon in a few minutes :)

So, I have explored various offerings of static blog site generators and found that Jekyll seems to be a good choice. Installing it on Mac was simple, I only had to get newer Ruby distribution. Since I use Homebrew, it was simple. After that installing Jekyll was simple and straightforward.

Then I have got the copy of Jekyll-bootstrap (http://jekyllbootstrap.com) which is a complete website environment with everything you might need: with support for Google Analytics, support for hosting the comments on DISQUS and other services etc. All you need is to play with it a big to get a sense of the things and then start migrating your data from WordPress.

I have followed some of the advices from (http://vitobotta.com/how-to-migrate-from-wordpress-to-jekyll). Converting the old posts to the files was simple, mostly because I did not have too many posts to convert.

When converting the posts it is important not to forget about the existing permalinks. It would be very wise to ensure that your new site will have the old posts accessible via exactly the same URLs as the old one. If not, you will lose many visitors, at least for a while. For that I just used “permalink” YAML property to force the same pathnames for the old posts. And for the new ones I will stick to the default pathname formatting.

Porting the comments was surprisingly easy (wow, something works just as described! ;) ). I have just exported my WordPress site into XML file and then imported the comments to DISQUS using their Web interface. It took a while, about 13 hours, I think DISQUS has some kind of queue. But in the morning I have found that all (or at least the most of) the comments are there. And since I have preserved the URLs of the old posts these comments just appeared there. Good job!

The last step was to reenable Google Analytics on the new site and ads from AdSense. For analytics it was a matter of putting the site ID into _config.yml. After regenerating the static site I have found that there was no Google Analytics code there at all. After digging around a bit I have found that in order to enable some production settings you need to run Jekyll with “-safe” option. This is the rule that applies regardless of how do you run Jekyll - as a local server or just as parser/generator.

Then I have decided to take advantage of this mode setting for the ads. Since I do not want to have false impressions while playing with the local copy of the site, I have organized my ads like this:

{% if site.safe == false %}

<div style="width: 728px; height: 90px; background: blue;">TOP AD GOES HERE</div>

{% else %}

Googe JS code goes here

{% endif %}

To simplify the customization, I have created the files like “ad-top”, “ad-bottom” etc (one file per ad unit in AdSense), placed them in _include/custom directory and included them with the line {% include custom/ad-top %} from index.md, pages.html, post template etc. Now if I need to change the ad I will be able to do it in one file and all pages will use the modified version right away.

This gives me a nice blue rectangle of the same size as the ad when running in non-production mode.

The rest was simple. I have created two scripts: one to regenerate the static version of the site:

#!/bin/sh
rm -rf _site
jekyll --no-server --no-auto --safe

And the second one to publish the updated version to S3 bucket:

#!/bin/sh
s3cmd sync --delete-removed _site/ s3://www.myhowto.org/ --verbose

That was it. The final touch: adding the redirect (GoDaddy offers it with their domain service) to redirect http://myhowto.org to http://www.myhowto.org. And, of course, the CNAME for www.myhowto.org to point to the name of my S3 bucket. And about one hour later (DNS record TTL) the new site was operational.

A few more links on Jekyll and Markdown:

When thinking about where to store the site I, obviously, considered GIT. Local copy is nice but I want a remote master one. So after looking at Bitbucket and others I have ended up using Dropbox - at least until I run out of space there :) This guide was very helpful.

I have also found an interesting tool for exercising the markdown format: (http://www.codecademy.com/courses/web-intermediate-en-Bw3bg/2#!/exercises/0).




blog comments powered by Disqus

Published

05 January 2013