Richard Perry

Just another blog about nothing

Instagram Digest Q1 2014 Tweaking Jekyll to Suit My...

Converting the Posts

  |     |   Technology, Jekyll

Update 15 June 2023

The Flickr Image and Flickr Photoset tags now seem to result in build errors so I have removed them from all posts and replaced with the previously generated HTML. I may try to make this cleaner at some point in the future, but no plans at the moment!

The next step in the migration to Jekyll was to export my existing blog posts from WordPress and then convert them into Markdown format so they can be used in the new blog. There are a number of different options for doing this, including Jekyll’s own migration option Jekyll Import Bearing in mind the purpose of the move was purely academic there was no need to rush this step so I tried a number of different options to see which one worked best for me. In the end, I used a little Python script written by Thomas Frössman called Exitwp. The Jekyll script was ok, but it pulled some random data from the WP SEO plugin that I was using, and didn’t properly convert the existing posts to proper Markdown.

Once Exitwp had converted all my posts to Markdown, I had to go through and make amendments to each file to ensure it was displayed correctly. This was not the fault of Exitwp, but my own personal preferences. I have setup a number of posts to display a certain way, and to include things in a specific position on the page so I had to make adjustments to suit this. For example, thumbnails in my posts can be on the left or the right of the page, or a large image could be included in the centre of the page. Jekyll’s default Markdown engine doesn’t support setting classes on different elements so I chose the Kramdown engine rather than using html. This meant I needed to make a few alterations to make sure the posts rendered correctly when the site is generated.

As part of the migration process, I also decided that I wanted to move all my photo hosting to Flickr, especially considering the 1TB of free file storage available there. So I set up a collection on Flickr for all my blog photos and I then had to change the image links in all my posts to match the new flickr image locations. To achieve this I used a couple of Jekyll plugins for Liquid tags which meant I simply had to include {% flickr_image 0000000 %} in the markdown file to show an image with a link back to Flickr (as per the terms of my Flickr account), or {% flickr_photoset 0000000 %} to show a gallery generated from a Flickr Photoset with the relevant links back to Flickr.

Flickr Image Tag Plugin

This is my modified version of the Flickr Image Tag Plugin written by Daniel Reszka.

Flickr Photoset Tag Plugin

This is my modified version of the Flickr Photoset Tag Plugin written by Jeremy Benoist.

comments powered by Disqus