Aug 18, 2011 - 2 minutes

Migration from WordPress to Jekyll

While I love WordPress - I think it was a bit of overkill for what I was doing on this blog so I converted everything to Jekyll, and threw all my images up on Amazon’s S3. I’ve also migrated all the comments over to Disqus.

One of the problems I ran into was getting the URLs to map the same; the _config.yml that worked for me was:

1 pygments: true
2 markdown: rdiscount
3 permalink: /:year/:month/:title
4 paginate: 10

And then to get my /apps/ working again I made a directory structure like this:

 1 apps//bluebug:
 2 BlueBug.zip	index.markdown
 3 
 4 apps//greenmail:
 5 index.markdown
 6 
 7 apps//light_logify:
 8 index.markdown
 9 
10 apps//pyultradns:
11 index.markdown
12 
13 apps//quote-of-the-day-tweeter:
14 index.markdown
15 
16 apps//rails_rrdtool:
17 index.markdown
18 
19 apps//server-setup-fu:
20 index.markdown
21 
22 apps//servly:
23 index.markdown
24 
25 apps//ventrilo-ping-analyzer:
26 index.markdown

Some nice helper scripts I’ve found:

Creating a new post

 1 #!/usr/bin/env ruby
 2 
 3 # Script to create a jekyll blog post using a template. It takes one input parameter
 4 # which is the title of the blog post
 5 # e.g. command:
 6 # $ ./new.rb "helper script to create new posts using jekyll"
 7 #
 8 # Author:Khaja Minhajuddin (http://minhajuddin.com)
 9 
10 # Some constants
11 TEMPLATE = "template.markdown"
12 TARGET_DIR = "_posts"
13 
14 # Get the title which was passed as an argument
15 title = ARGV[0]
16 # Get the filename
17 filename = title.gsub(' ','-')
18 filename = "#{ Time.now.strftime('%Y-%m-%d') }-#{filename.downcase}.markdown"
19 filepath = File.join(TARGET_DIR, filename)
20 
21 # Create a copy of the template with the title replaced
22 new_post = File.read(TEMPLATE)
23 new_post.gsub!('TITLE', title);
24 
25 # Write out the file to the target directory
26 new_post_file = File.open(filepath, 'w')
27 new_post_file.puts new_post
28 new_post_file.close
29 
30 puts "created => #{filepath}"

Publishing a new post

1 jekyll && rsync -avz -e 'ssh -p SSHPORT' --delete . USERNAME@DOMAIN.com:/home/YOURPATH/

comments powered by Disqus