Episode: 1607
Title: HPR1607: Migrating from Drupal 6 to Nikola
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1607/hpr1607.mp3
Transcribed: 2025-10-18 05:44:27

---

It's Tuesday 30th on September 2014.
This is an HPR episode 1600 and 7 entitled, Migrating from Rupal 6 to Nicola.
It is hosted by Johan and is about 10 minutes long.
Feedback can be sent to Johan.verv at email.com or by leaving a comment on this episode.
The summary is, I explain how I migrated my Rupal 6 to Nicola.
This episode of HPR is brought to you by an honest host.com.
At 15% discount on all shared hosting with the offer code, HPR15, that's HPR15.
Better web hosting that's honest and fair at an honesthost.com.
Hello, this is Johan here again for Hacker Public Radio.
I'm going to talk about how I migrated my blog from Rupal 6 to Nicola.
You might have heard about Nicola on episode 1577 of HPR.
It is a static website generator.
First of all, why did I migrate?
Mainly because I had some issues with my Rupal blog.
The way I want to write texts is not very compatible with the way Rupal works.
I want to write text when I am offline, like for example on a train.
I want to use film for writing, because I really like that editor.
And I want to use Git to manage different revisions of what I write, because it often
takes a lot of editing before I am satisfied.
I used to have a git repository to write my blog posts, and when I was happy with the
text, I copied pasted it into a Rupal web interface.
This is a kind of tedious.
So I saw the light when I heard HPR 1577, in which Gitterman talked about Nicola.
He convinced me that I needed to use a static website generator for my blog.
So I migrated my blog from Rupal 6 to Nicola, and I will tell you how I did this.
Maybe this is of interest for other HP listeners.
First of all, some details about the Rupal site I migrated.
I did not have node revisions on my Rupal site.
My Rupal site had one vocabulary.
This was used to assign text to each post.
I did not use page aliases.
So each post I had had a URL like JohanV.org slash node slash 195.
Probably also mentioned that I used Pandoc version 1.12.3.3 to convert the HTML of the
nodes to restructure text.
That's a format that Nicola uses by default.
If you have another version of Pandoc, you probably have to tweak the script I used.
So for the migration, I first of all created a new subdomain for the blog, blog. JohanV.org.
Then I used a script that creates a blog post for every published Rupal node on my Rupal site.
The script was created with a lot of trial and error.
It can probably use some improvements.
I invite you to take a look at it and send me pull requests.
The script sends queries to the database of the Rupal instance to do the following.
It gets the timestamp title and text for each node.
With this metadata, it creates RST document.
Then there is a lot of manipulations on the node content before it adds the manipulated
content to the document.
So these lots of manipulations are the following, a conversion from HTML to RST.
Some fixes in line endings, a conversion to convert references to other posts from
the old format, node slash post ID, to the new format.
It also fixes some issues with blogs with literal code in the blog posts.
And it converts links to YouTube videos.
I won't read out the whole script because that wouldn't make a lot of interesting radio.
But I will put a link in the show notes.
The script is rather ugly.
You will have to edit the first lines describing how you can connect to the database.
It assumes your credentials are in the My.CNF file.
You will also have to specify where the output file should go.
By default, I put them in slash TMP slash out.
You will probably have to tweak the script to adapt it to your needs, but you will have
a starting point.
The script converts each node, for example, uonv.org slash node slash 195 to a blog post.
This way, I could easily convert hyperlinks to other posts to the corresponding HTML page
of the new blog.
On the location of my old blog, I put an HD access file that will redirect all requests
in the form of slash node slash number to the correct page on the new blog.
I will also put this HD access file in the show notes.
With the combination of the script and the HD access file, 90 percent of the migration
was very easy, but as always, the remaining 10 percent needs some manual work.
Like for example, I had some YouTube links containing underscores.
My conversion script converts them to backslash underscore, which wasn't right.
There were too many of them, so I fixed these use manually.
Another thing I had to do manually was migrating the attachments and the images to the new
site.
I didn't have too many of them, so I didn't need to write a script for those.
So this was how I migrate my site from Drupal 6 to Nikola.
I hope you found it interesting.
If you want to, you can comment on this episode on blog.uamv.org slash Drupal-Nikola.
You can use the discuss thingy over there, or if you don't want to use this because you
can also send me a pull request because all the sites can be found on GitHub.
I want to thank Hacker Public Radio, first of all for introducing me to Nikola, and of
course, HPR allows me to share how I did my migration with you.
So if you have something interesting to tell, please submit an episode to HPR yourself.
If I can do this, you can certainly do this too.
This was Uamv for HPR, signing off.
You've been listening to Hacker Public Radio at Hacker Public Radio.org.
We are a community podcast network that releases shows every weekday Monday through Friday.
Today's show, like all our shows, was contributed by an HPR listener like yourself.
If you ever thought of recording a podcast, then click on our contributing to find out
how easy it really is.
Hacker Public Radio was founded by the Digital Dog Pound and the Infonomicon Computer Club,
and is part of the binary revolution at binwreff.com.
If you have comments on today's show, please email the host directly, leave a comment on
the website, or record a follow-up episode yourself.
Unless otherwise stated, today's show is released under Creative Commons, Attribution,
Share a Light, 3.0 license.
