Category: English

Date:

I had serious problems with Wordpress. I was receiving attacks, I had to perform updates immediately, otherwise attackers were using the 0-day vulnerabilities of Wordpress and its plugins. Also MySQL database was crashing every month or so, and I had to restart it everytime it crashed. A huge headache. Then I decided to migrate to static HTML files.

Wordpress to Jekyll

But it was not easy. jekyll-importer could not parse the XML file I exported from Wordpress. I tried Pelican and it had a different problem with parsing. I guess the errors were due to posts containing django template code. Then I found a plugin called jekyll-exporter. It worked! I could use the markdown files exported via this plugin on Jekyll.

However, I was not a Ruby guy and could not customize the site according to my needs. Then I decided to migrate to Pelican. How hard could it be? It was not easy. There were some syntax differences between the two even though they were both Markdown.

Jekyll to Pelican

First of all, I had to remove triple dashes covering the metadata:

sed -i '' '/---/d' *.md

Then I had to rename "categories:" to "category:"

sed -i '' 's/categories:/category:/g' *.md

Then I had to remove .html extensions from the permalinks:

sed -i '' '/permalink\:/s/\.html//g' *.md

Then I had to rename "permalink:" to "Slug:"

sed -i '' '/permalink:/s/permalink:/Slug:/g' *.md

Then I had to remove the preceding slash from the slug:

sed -i '' 's/Slug: \//Slug: /g' *.md

Then I had to replace some characters like quotes, triple dots, dashes:

sed -i '' 's/’/''/g' *.md
sed -i '' 's/“/"/g' *.md
sed -i '' 's/”/"/g' *.md
sed -i '' 's/…/.../g' *.md
sed -i '' 's/–/-/g' *.md

Categories and Tags were not comma separated but enumerated with "-". I wrote a Python script to choose one category as "the category" and move the rest to the tags list and separate the tags with commas, instead of enumerating them. I had to assume every post had at least one category and one tag. The script was a custom one suitable for my needs so you will have to customize it if you want to use it.

At the end, I'm now using Pelican + Markdown. Good luck!


Share: FacebookGoogle+Email


Receive notification on my new posts

* required
Languages*   
* Different contents, not direct translation. You may choose both if you wish.
comments powered by Disqus