Regis' Blog

L'informatique, L'amour, Les vaches

Bye Bye Wordpress
May 15, 2016
in Blog Wordpress |
Share this post
| |
Bye Bye Wordpress

I need a blog engine, just a blog engine... nothing else. So for the fourth time, I decided to move this blog to a new blog engine: Ghost. My last experience with Wordpress wasn't fun. Every body scream about this blog engine, but nobody do nothing, except the Ghost creator, a former Wordpress developer.

I can tell you in a long and not so easy to read post why I'm leaving Wordpress but what for? The question is not "Why leaving Wordpress?" but "What can I do with my new blog engine?"

And what can I do is to tell you how I did it?

Blog transition

It's not easy to witch from a blog engine to another. First you need to install on your Wordpress blog the plug-in to export in the Ghost format. In this article there's a lot of tips to easily migrate from Wordpress.

But...

You will lost all you code formatting. In my case I used a plug-in to format the example codes. Every code formatting was lost.

And also your pictures in some case. In mine it was ALL pictures.

How to do ?

Easy when you know where to go.

The easy part

  • Backup on your computer your Wordpress blog... completely. Remove everything except wp-content
  • In Wordpress export your articles and pages with the plugin Wordpress to Ghost. Follow the tutorial and everything goes fine.
  • Then I followed this post of Patrick Nommensen for the complete NGinx configuration file.

The long part

At this point, you're able to add a new post and your previous posts are online. But in my case all URLs were wrong. With Wordpress this wasn't a /year/month/title/ URL but just /title/ URL.

So I took the Wordpress exportation file (the normal one, not the Ghost one) and with a little Python script, I recovered all my URLs. Then with the Ghost sitemap.xml I recover the Ghost URL. With Notepad++, Regex and 1 hour, I have a descent list of URL.

The little python script:

import re  
content = open('thewordpressfile.xml', 'r').read()  
links = re.findall(r'<item>.*?<link>(.*?)</link>', content, re.DOTALL)  
with open('links.txt', 'w') as f:  
  for link in links:
    f.write('rewrite {0} http://youblogurl.com/ permanent;\n'.format(link)

Little my little, every legacy Wordpress URLs was match with the new URL following the rewrite NGinx rules

rewrite /old/url http://your-urls.com/year/month/old/url permanent;  

Then I copy and paste into the NGinx config file for the redirection.

Now my blog is working perfectly well an quite faster than before.

What's new

New blog, new things.

One language

First of all, no more French post except from time to time when it makes sense. It was really hard to maintain this blog in both French and English.

Fun with Markdown

The main improvement for the new blog except speed, security and light memory footprint (no MySQL database too) is Markdown.

Markdown is a perfect convention for blogging. Don't think, just type.

Comments

Also, I use Disqus (yes again). I will tell you why I think our privacy is dead and why it's a good news...

Conclusion

It was a funny hacking day.
Have a nice day folks.