, 4 min read

Migrating from delicious.com to WordPress

I have been a loyal user of del.icio.us since 2006. I have written on this in my post Saving URLs in del.icio.us Still Troublesome. But now enough is enough. Here is a list of annoyances:

  1. You can neither export nor import your data anymore.
  2. The service is generally slow, i.e., it takes a lot of time to just load the site in your browser.
  3. The service is sometimes not available.
  4. You cannot change URLs without deleting the entire post.
  5. The company behind the service does not answer any inquires.
  6. The site is blocked by a number of company firewalls because it is marked as "social".
The first mentioned annoyance was now the turning point to hack together two [Perl](https://www.perl.org/ "Perl") scripts to get the content into [WordPress](https://klmlinks.wordpress.com/ "WordPress"). The challenge with this was: As there is no longer an export file one has to resort to the [del.icio.us](https://del.icio.us/ "del.icio.us") website, page-down as long as all relevant entries are shown, and then save this HTML-file. Luckily I had an export file dating back to 25-Oct-2014. So I combined the export file with the web-content. This was then imported to WordPress.

My first aim was to bring together this blog and my more than 2,000 links into a single blog, i.e., this blog. Unfortunately this is not really satisfactory, as my list of links will then either intermix with my regular blog-posts, or I have to set up a static page, and then use categories to switch between the other WordPress pages, see Category Pages. The catch here is:

If you don’t want posts displaying on any page other than their designated category pages, you can set up a static front page and not designate any page for your posts page. Remember to add your static home page to your custom menu.

Also, as I use Publicize, I would have to specifically suppress this feature for my links, where I don't want to tell the world on my newly detected URLs. So the best solution seemed to be to create a completely new blog. This solves the separation issue, the Publicize issue, and it was good while importing to WordPress, as to not break existing posts.

It is quite surprising that I did not come up with this solution much earlier, as I actively use WordPress since 2012. I searched for a way that the link (URL) is the title, and the snippet of the content behind the link the actual post. This can be achieved with the "Link-Format" for a blog-post. I had never used this before. This allows you to highlight links in your post. This is exactly what I wanted with my long list of URLs. Although the "Link-Format" highlights all text looking like URLs.

Perl script delicious2wp converts del.icio.us export-file to WordPress post-format, i.e., WordPress eXtended RSS (WXR), see The WordPress eXtended Rss (WXR) Export/Import, XML Document Format Decoded and Explained. Perl script deliciousweb2wp converts the raw HTML file to WordPress post-format. I left out a number of XML tags, because I thought WordPress would generate them automatically, which it did. I checked my output with xmllint. At first I exported my blog, then had a look at the XML file, after that I hand-guessed what probably would need to go into the export file in my case. If you want to use these scripts for your case you have to change the blog-name, here klmlinks.wordpress.com, and blogger-name, here eklausmeier. I added command-line argument -o for an offset in the post_id, and -n to limit the number of posts to convert. The last option is mainly for testing, i.e., just try to import a few posts. I exported my newly created blog, then searched for the highest post_id, added some safety margin, then this was my offset.

perl -ne 'print "$1\n" if /<wp:post_id>(\d+)/' elmarklausmeier039sweblog.wordpress.2015-01-01.xml | sort -n | tail

post_id's in the export file are not necessarily in consecutive order and some numbers might be missing.

I checked whether my new blog contained the links I wanted.

perl -ne 'print "$1\n" if /^<DT><A HREF="http(.+)" ADD_DATE=/' D > Dref
perl -ne 'print "$1\n" if /^    <a href="http(.+)" class=/' F > Fref
sort Fref Dref > deliciousURLs
perl -ne 'print "$1\n" if /^  <content:encoded><!\[CDATA\[<a href="http(.+)">/' collectedlinks.wordpress.2015-01-04.xml | sort > blogURLs
diff deliciousURLs blogURLs

Exporting your blog is usually quite quick, i.e., a few seconds. Importing into your blog is asynchronous, i.e., you receive an e-mail once WordPress has imported all your data. This might take 10-20 minutes. In particular I noted that importing double entries might eradicate the whole import.

Added 13-May-2015: It looks like import and export functionality in delicious.com is again working.

Added 22-Apr-2017: delicious.com no longer exists, you have to use del.icio.us.