{ Josh Rendek }

<3 Go & Kubernetes

Migration from WordPress to Jekyll

Aug 18, 2011 - 2 minutes

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:

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

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

 1apps//bluebug:
 2BlueBug.zip	index.markdown
 3
 4apps//greenmail:
 5index.markdown
 6
 7apps//light_logify:
 8index.markdown
 9
10apps//pyultradns:
11index.markdown
12
13apps//quote-of-the-day-tweeter:
14index.markdown
15
16apps//rails_rrdtool:
17index.markdown
18
19apps//server-setup-fu:
20index.markdown
21
22apps//servly:
23index.markdown
24
25apps//ventrilo-ping-analyzer:
26index.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
11TEMPLATE = "template.markdown"
12TARGET_DIR = "_posts"
13
14# Get the title which was passed as an argument
15title = ARGV[0]
16# Get the filename
17filename = title.gsub(' ','-')
18filename = "#{ Time.now.strftime('%Y-%m-%d') }-#{filename.downcase}.markdown"
19filepath = File.join(TARGET_DIR, filename)
20
21# Create a copy of the template with the title replaced
22new_post = File.read(TEMPLATE)
23new_post.gsub!('TITLE', title);
24
25# Write out the file to the target directory
26new_post_file = File.open(filepath, 'w')
27new_post_file.puts new_post
28new_post_file.close
29
30puts "created => #{filepath}"

Publishing a new post

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

comments powered by Disqus