Pelican Blog Setup

Sat 06 April 2013

Filed under Blogs

Tags Cool Geek

Up To

Where do I begin with this migration? I have been disgusted with Typo for a while. It has required more and more resources and tweaking. It is never as simple as I wish it was, from the operations side. My friend Cliff keeps developing his own stuff, but he does not share, and it's non-trivial to get it out of him. Wordpress is PHP, and I will never willingly use PHP again.

I continue to gripe, when Passenger suddenly consumes >2GB of RAM or does one of it's famous crashing-tricks. If I enjoyed Ruby or Rails, I think I might try to fix my problems, but ultimately, I just want them to go away. So, Pacopablo mentioned Pelican. It seemed decent enough. Though simple, it required a completely different approach. I spent a deal of time figuring out the basics, but the most important fact is the support for Wordpress XML files. There is a tool Pelican Import which lends itself neatly to my problem.

Real Requirements

I have one: publishable. After that is convenience/interface, etc. After that is feedback. If we need to speak, let's do it on Google Plus. I have slowly been purging the blog-feedback anyway. It's just a place for drug-sites to recommend dubious warez.

Migration Concerns

First, I went to obtain some help in exporting from Typo to a Wordpress XML format. Competo has a nice article which is summed here. Get the files, copy them into the directories as instructed, and off you go. Run your rake commands and life will get easier. I used essentially exactly his steps, but I punted on the tags file. There were literally so many tags that I couldn't even start to trim it, so I deleted them all.

Once I got the file, I followed the import instructions at Pelican and started the porting. reStructuredText is neither here nor there. It is a complete system with rough edges and wide use. It's perfect for this. Pelican-Import mostly handled it, I just needed come cleanup.

Major errors:

  • UTC-tag on the XML data caused errors.
  • tags came across as categories (I was not able to find a canned way to fix this.)
  • all my <pre> block formatting was a wreck.

Sed Work

# kill UTC mention
sed -i foo 's:UTC<:<:g' *rst
# rename categories to tags
sed -i foo "s/^:category:/:tags:/g" *rst
# fixup my old <pre class=code> adaptions
sed -i -f "s:code\:\::code-block\:\::g" *rst
# change the name which ended up on the historic posts.
sed -i -f "s:menion<:Joshua<:g" blog2.xml

Pre-Formatting Errors

There were no good ways, so I ran a grep to locate them, and opened them in emacs. Then I fixed all the 53 broken files manually.

emacs -nw `grep -l 'code::' *`


The original paths were retained, so I created an images directory names /files and I copied everything there from the old Typo folder. It worked on my first try.


One-hundred and twenty-three articles consumed approximately 4 hours, including a script in python to allow me to edit/generate categories. The script would be better in awk or something, but I know how to write Python without using manpages or research.


My effing SVN server will not import the restructured text. I get lambasted with errors. I will have to sort this out, or migrate to Git.... but I am DONE with upgrading anything today.


Up To Something © Joshua M Schmidlkofer Powered by Pelican and Twitter Bootstrap. Icons by Font Awesome and Font Awesome More