Getting Started with Jekyll - Transitioning Content

In this post we’re going to discuss how we can move our content from our existing blog. 2016-10-20-Getting-started-with-Jekyll-Part-7

  1. Getting Started with Jekyll - Setting the Scene
  2. Getting Started with Jekyll - Finding a Theme
  3. Getting Started with Jekyll - Common Theme Settings
  4. Getting Started with Jekyll - Setting up Jekyll in Docker
  5. Getting Started with Jekyll - Learning Markdown and Liquid
  6. Getting Started with Jekyll - Modifying Templates
  7. Getting Started with Jekyll - Transitioning Content <==
  8. Getting Started with Jekyll - Launching your Site

Nice and simple

By now I’m sure you guys are sick of listening to me waffle on, and thankfully, for this part, you won’t have to.

Long story short; when I was originally designing this series of posts, I wasn’t aware of a lot of the community surrounding Jekyll and how involved they truly are (mind you - Jekyll has been around for nearly 10 years!) - I’ve learnt a lot by writing this series of posts, and so the best I can do for you now is show you where some of the best resources are found.

Show me the … docs

In terms of migrating content from an existing site, you really can’t go past the official documentation which will point you towards their sister site: Jekyll Import. From there, it’s just a matter of following the steps for the system that you’re coming from! Tried, proven, working, and with over 20 documented importers, you should be able to find yours in the list.

Yeah, but these are for ‘ruby’ people

Granted, most of the import documentation assumes that you have a locally available version of your site, and a locally available version of Ruby and all the Gems for Jekyll. Thankfully, after our experience in Part 4 of working with Docker containers, we can re-use this knowledge and run this in an interactive Docker container!

For now, here’s a series of steps that’ll help you get it up and running in an interactive session so that you can test it out, and if it all works fine, then you should be able to copy the files (provided you have your mount points working) onto your local system and then copy them into your new site!

Let’s run the following script step by step from Powershell:

# Run the standard Jekyll image interactively and start a bash session:
docker run --rm -ti -v $(pwd):/usr/content jekyll/jekyll /bin/sh

# Update ourselves and install Ruby dev tools:
apk add --update ruby-dev

# Update GEM so that we can find our packages 
# without SSL cert errors - this could take a while!
gem update --system && gem update && gem cleanup

# Install the Jekyll Import module:
gem install jekyll-import

# Change to our mounted directory:
cd /usr/content

# Now go ahead and install your other importers and go nuts :)

Working with the final output

Thankfully the files that the jekyll-import gem produces are normally pretty clean, and should slot straight into your sites theme, but of course, that cannot be guaranteed and it’s probably best that you double check every, single, page. ☹

Great, I’ve got a whole lot of content to parse

Yep, but good work on creating all that previous content - I’m envious.

For now, we should be done migrating our existing content to Markdown/Liquid and have them rendering in our new site, so jump over to the last part: git pushing your site and sending it live!


Author |

.Net developer, public speaker, challenge addict, father, husband and (most of all) geek. Interesting problems & inspiring solutions get me out of bed in the morning. Currently a Lead .Net Developer at Coolblue in Rotterdam, NL .