Migrating Delicious Bookmarks to WordPress
Delicious is one of those services that few people know about but loved (and probably hated in equal measure) by those who use it. Their offering is easy to grasp: Delicious is a social bookmarking service that lets you "Save, organize, and remember the links you find interesting or useful around the web." I'm sure you've been in a situation where you've tried to remember the source for a particular factoid or needed to cite an article but lost track of the link. The obvious place to save links is in the browser bookmarks but this quickly becomes unwieldy if, for example, you're doing research on lots of different topics. Unless you install bookmark syncing software, browser-based bookmarks are also cumbersome if you run different browsers and computers. I used Delicious to store thousands of links over the years, all of which where tagged and easy to call up when needed. They say in their about page, "Delicious remembers so you don't have to. It's easy to build up a collection of links, essentially creating your own personal search engine." It was great at that and absolutely invaluable if, like me, you have a poor memory. Programmers, bloggers, researchers, anyone who needs to save a link for future recall needs something like Delicious. Founded in 2003, it's also a veteran in an industry where anything that lasts more than a couple of years is considered successful.
Sadly, this glowing opening isn't to recommend the service. You'd think its longevity would be a sign of a rock-solid, mature platform but no: Delicious' loyal user-base has been rewarded with outages, lost data and broken features. That people persisted despite years of problems shows just how useful a service it provides. When the site went down again earlier this year (2016), I decided it was time to make a move. Unfortunately I couldn't find an alternative trustworthy enough for several years-worth of carefully curated bookmarks. Free web services are notorious for disappearing into a black hole with all your data. As the saying goes, you get what you pay for.
After a long search, I began to realise there wasn't anyone out there who could be trusted. This isn't just Delicious and bookmark curation problem though. These past few years has shown that The Cloud hasn't lived up to its promise. Data breaches, surveillance, data collection, outages, and catastrophic meltdowns; we can't really trust a third-party service, especially if they don't have a clear business model. I grudgingly conceded that cobbling together my own solution was the only option.
The rest of this post describes my solution, why I chose WordPress and how you can convert your WordPress site to host a personal bookmarking service. This will be valuable even for those who've never used Delicious but would like a way to curate links.
Exporting the bookmarks
Before doing anything else, the bookmarks need to be in form that's easy to manipulate. Delicious had a feature to export all your links, tags and notes into a HTML file Netscape bookmark format. At the time of writing this has been 'temporarily disabled due to server load' (really, Delicious?). Fortunately I was in the habit of making frequent backups due to Delicious' unreliability so my export file was only a few weeks old. I threw together a quick Python script called DeliciousPy to scrape the file and save the results into a local MySQL database. Feel free to grab the source over on GitLab.
It was a one-use tool so a little rough and undocumented. (Sorry, it wasn't written with the intention of public release!) Anyone with basic Python knowledge should be able to easily figure out how it works. Essentially, I parse the Delicious export file using Thibauld Nion's Netscape bookmark parser that is part of his Water On Mars! project. Everything is then inserted into three MySQL database tables:
- bookmarks: the table storing bookmark title, url, note, creation time and privacy flag.
- tags: all the tags associated with the Delicious bookmarks.
- tag_relationships: the relationships between the bookmarks and tags.
After doing a pip install
to install the requirements, you run DeliciousPy with the command:
$ ./deliciouspy.py -p /path/to/delicious/export_file.html
Running the script exports:
- Bookmark title
- URL
- Tags
- Note
- Created date
Getting the Delicious bookmarks into a database opens up options for importing the data into a different platform. You can roll your own custom tool or use a content management system. I chose WordPress.
WordPress as a personal social bookmarking service
My wish list for a Delicious replacement was short:
- Save links with accompanying notes.
- Tagging and search to easily call up previously saved links.
- Simple, bare-bones functionality free of unnecessary features.
- Set links to private for personal research or public for sharing.
- Avoid relying on a third-party service.
It didn't take me long to settle on WordPress. I already have expertise with importing data into WordPress from my Drupal to WordPress migration service. It's grown into a mature content management platform with a huge user and developer base, apparently powering 25% of all websites. It has excellent documentation, can run on a standard hosting package, has a simple user-interface and a flexible taxonomy system. The code is open source so if you self-host the site, you won't run into the third-party service problems of getting locked out of your data. WordPress has all the components for a home-brew bookmarking service.
My Bookmarks plugin
I'd originally hoped to avoid building my own plugin but none of those in the WordPress Plugin Directory suited my needs. Most were too feature-packed and I wanted something lightweight: just have some way of saving and tagging links for later retrieval. Putting together simple bookmark storage isn't difficult: 'bookmarks' can be nothing more than a post with a single custom field to store the URL. To keep them separate from standard blog posts, I created a custom bookmark content type and packaged it into a plugin called My Bookmarks. (I'm not very imaginative when naming things.)
Delicious has a social bookmarking aspect that lets you publish your links, follow other users and discover pages those in your network have saved. Social bookmarking wasn't compelling for me so I didn't attempt to include this functionality. In my opinion, publishing the links on a blog is social enough and any anyone who wants to 'follow' can subscribe to the RSS feed built into WordPress.
Bookmark sharing id controlled through the normal WordPress Visiblity setting. Set to Public so the bookmark gets posted on your blog; set to Private so it's visible only after logging in to WordPress.
One great thing about Delicious was a handy bookmarklet that allowed you bookmark your browser's current open page. Rather annoyingly, this feature broke for me at some point after it was acquired by one of its many owners. I implemented this functionality in the form of a WordPress-style Press This bookmarklet. Code from the now seemingly abandoned Linkmarklet plugin by Jonathan Christopher does most of this work.
Experience so far
The My Bookmarks plugin hasn't been published to the WordPress Plugin Directory as of now. I'm still trialling it to make sure everything works as expected before releasing but you're welcome to grab the source and tinker with it for your own needs. Note: As of December 2016, the My Bookmarks plugin is temporarily hosted over on GitLab.
Currently the plugin is installed on my internal Wordpress-based Knowledge Management System on my local network. It serves up thousands of bookmarks from around 10 years worth of links. I replicated everything that made Delicous so useful for me without all the drawbacks of a third-party service. So far so good. The bookmarks that I've spent years curating are now fully under my control—and under my responsibility. Backups are still important but bookmarks are now included with my usual automated WordPress database dumps. All-in-all, I think it was a good move to finally migrate from Delicious.