Importing Jekyll Posts into WordPress

Nearly four years ago I switched my main site over to Jekyll. It’s been great. But late last year I decided to make that site and its blog purely about my software business and move all of my non-work posts over to my tyler.io domain so I could have a personal site again. To encourage myself to write more, I built the site with WordPress so it would be easy to publish. That meant I needed a way to convert and import all of my old Jekyll Markdown posts into WordPress. I found a few scripts that exported WordPress into Jekyll, but not the other way around. So I hacked together my own script, which I’ve pasted below. Hopefully this will help anyone wanting to make the same transition.

The script takes a directory of Markdown posts in the following format, reads their header meta-data, and imports them into your WordPress database.

date: 2013-04-08 20:57:14
title: PebbleCam
layout: post
permalink: /blog/2013/04/pebblecam/index.html
slug: pebblecam
---
Post content...


Categories
Jekyll PHP

5 replies on “Importing Jekyll Posts into WordPress”

I found this script and would love to use it since my blog with 7000+ posts takes forever to build with Jekyll.

However, I ran into a problem. I understand if you’re not interested in giving support or anything but it never hurt to ask.

I get this:

PHP Notice: Undefined offset: 1 in /jekyll-import.php on line 20

PHP Notice: Undefined offset: 2 in /jekyll-import.php on line 20

PHP Notice: Undefined offset: 3 in /jekyll-import.php on line 20

The import still runs and the posts turn up in WordPress but all my posts get 1970-01-01 as a date. I have almost zero knowledge about PHP (and programming in general) and really have no idea how to fix this.

Thanks,

Joacim

Hi, Joacim.

The script worked for me the last time I tried it (a few months ago). I’m happy to offer support via my standard consulting rate. Given a zip file of your Jekyll posts, I can likely get you a WordPress database file you can import within an hour or two worth of work. Feel free to contact me if you’d like to go that route. Cheers!