Dec 02, 2015

Migrating to Pelican

I recently migrated my blog from Wordpress to a static site generated by Pelican. This post is a quick debrief of the process.

I migrated the site because the Wordpress UI felt clunky, Pelican-generated sites are sleek, and I wanted a project that would help me learn more about programming (I find it difficult to learn things when I don't have projects I can apply the content to).

I chose to use a static site generator. I know some HTML and CSS, but they can be a pain to work with, and any site I built from scratch would not be nearly as nice as one built off a theme, at least to start. Pelican has a nice selection of themes; I went with Nevan Scott's Mockingbird.

I chose Pelican over other static site generators because I already know a little Python, want to learn more Python, and don't want to mess with Ruby (which other popular generators are written in). I didn't think about which generator to choose as hard as some people. I was surprised at how little syntax was required to generate the site – if other generators are similar, I could have gone with a generator written in any language and used another criterion to decide on which one.

The migration was fairly intimidating at the outset. I found a couple of walkthroughs, and the Pelican documentation is pretty good, but all of that material presumes that you sort of know what you're doing from the start.

As someone without a strong technical background (read: someone who doesn't know what they're doing), it took a while to understand what all the pieces were and how they fit together. Here's a conceptual walkthrough of what I did:

  1. Installed Pelican and the other requisite libraries using pip. This took a while because I had a lot of random Python stuff installed thanks to a previous Enthought Canopy installation. I ended up doing a fresh install of regular (non-Canopy) Python.

  2. Tried to set up a virtual environment, which the Pelican documentation recommended. I set up a virtualenv for Pelican, but ran into a weird bug when I tried to migrate my Wordpress files from within the environment, so ended up just doing everything outside of the virtualenv. This might come back to bite me in the future, though I don't plan to be running a ton of different Python projects that all rely on the same libraries, so it should be okay.

  3. Imported my posts from Wordpress. The pelican-import tool is nifty – it pulled each post and page from the XML file I exported from Wordpress and converted them into separate Markdown files.

  4. Learned Markdown syntax. As the name sorta implies, Markdown is a minimalist markup language. It's way easier to write in than HTML, which is what I had been doing previously.

  5. Chose a theme for the site. I wanted something minimal and flexible that wouldn't look really bad in five years. Nevan Scott's Mockingbird fit the bill.

  6. Ran pelican-quickstart to generate my site structure, and pelican to convert all my posts from Markdown into HTML.

  7. Uploaded the files generated by pelican to my server using FTP.

    Filezilla was the FTP client I used. My site is hosted by Siteground; their support chat was somewhat helpful in figuring out how to turn off my Wordpress installation and how to use FTP. This tutorial was also helpful.

  8. Clicked through posts; fixed formatting and links that had broken during the XML –> Markdown –> HTML conversion or during the upload.

And that's it! Eight steps to build your own Pelican-generated site!

To keep me honest, here are some things I still need to do before the site is fully operational:

  • Add my nice balloon-taking-off-from-a-greek-temple photo
  • Add a favicon
  • Add RSS capability
  • Add comments (maybe)
  • Tweak the color palette
  • Fix the "posted on" date at the bottom of all posts

[rereads: 1, edits: formatting tweaks, later: fixed some formatting related to this migration, somewhat ironic]