I wanted to write a little bit more and having more control over the blog. On top of that, I stumbled upon the so-called flat file CMS and after a couple of minutes, I was already reading about https://getgrav.org/. So I quickly bought a hosting service and installed it.
This CMS is tidy and neat, easy from the first moment, with good support, plenty of plugins and themes. On top of that, the content is written in MarkDown. It looked lke the perfect solution for my little space. Unfortunately, I have already a blog with a couple of articles and I am too lazy to rewrite even the few articles that I previously wrote on my Wordpress blog, so I googled for a way to migrate the existing blog entries. In this article I am gonna describe how to quickly and easily Wordpress blog posts into Grav posts.
Moreover, if you want to read more about the pros and cons of Wordpress and Grav you can probably start here.
Despite the apparent huge migration from Wordpress to Grav, and promising documentation about migration, there was no easy solution. For example, even wp2grav did not seem to work as I wished. Other tools, like wp2grav were incredibly old. After a few minutes, I thought it would be easier to just export my Wordpress blog and convert it to MarkDown. So I am going to describe the steps to take in order to migrate your blog.
Converting posts
WordPress has a nice export feature to download everything you have made.
- So, make sure to export all your posts through your admin interface.
- Download the zip file, copy into your preferred folder and unzip the file.
- You should get one xml file or more of them.
Now it is time to convert your posts. First, you will need to install pelican and make sure some other dependencies are met.
pip install pelican markdown lxml
Once everything is installed, you can convert your posts from HTML to Markdown. If you look at the help section of the pelican-import
you will spot the following lines:
--wpfile Wordpress XML export (default: False)
-m MARKUP, --markup MARKUP
Output markup format (supports rst & markdown) (default: rst)
So, the following command will do the trick for us, giving us a list of Markdown files for my posts to upload to Grav through FTP.
pelican-import -m markdown --wpfile -o posts my_awesome_blog.2018-11-29.001.xml
Grav configuration
There was not a lot to configure, to be honest. I had to choose a theme and customize my installation with plugins.
Theme: Antimatter - I choose it cause it is pretty simple and configurable, tidy and neat. Plugins: Few simple plugins gave me everything I need
- AboutMe - To add a nice short bio on the side
- Seo - To customise a little bit the blog post for better rendering on google and twitter
- SimpleSearch - To allow people to search on the blog
- TaxonomyList - To tag blog entries with tag