Second part of our serie on Delicious’ bookmarks. In the previous post, we didn’t find plugin or tool to synchronize links between Delicious and WordPress. So if we decide to develop our own solution, we have to look at the detailed requirements, and study which tools are available in Delicious and WordPress to build this synchronization tool.
- This post is an english translation of the post Synchroniser Delicious et WordPress: le cahier des charges
The main objective is to synchronize the lists of links between Delicious and WordPress.
When I say synchronization, I mean:
- Create into WordPress, links that exist in Delicious, but not in WordPress,
- Update links into WordPress, when these links exist in the both tools, and was modified in Delicious,
- Delete links that exist in WordPress, but not in Delicious
So when I speak about synchronization, I speak about alignment of the blogroll of WordPress from the linkroll of Delicious one.
Three subjects to study: fields to be used, classification, and update method.
Start simple: field association
WordPress and Delicious don’t give us the same fields to manage links.
The following table shows the list of fields managed by both tools, and the possible association.
|Categories||Tags / Bundle|
It’s a more complex subject.
Delicious classifies the links with Tags. These Tags can be grouped within Bundle. WordPress classifies links using Categorie.
- Make a direct association (one to one) between Tags and Categories,
- Associate lists of Tags with Categories (many tags to 1 category),
- Associate bundles and categories.
The first approach is heavy to do. Tags and Categories are not use in the same manner. The number of categories is often very lower than the number of tags, and tags are already used in WordPress. Perhaps we can create as many categories as tags, but that means we have to evolve our blog structure.
The second approach is more reasonable: we can build associations between sets of Tags and a Category. In the manner, we don’t modify either Delicious’ structure, nor WordPress’ structure. We just need to maintain a table between the two tools. The disadvantage is perhaps that the method requires to keep this table up-to-date: if we have a big amount of Tags, the updates can be heavy.
The third method is very similar to the previous one, but we use the bundles rather than Tags. The number of bundles are generaly lower than the number of Tags. The table between the two tools will then easier to manage. The idea could be to have a list of bundles in Delicious, strictly similar to the list of categories in WordPress.
The two synchronization modes usually used are: full and incremental.
The first one is easy to code: we delete all the links in the target database, and we copy all the links from the source database.
The incremental method is often more complex, because it needs additional information: first the list of changes since the last synchronization, and then a way to identify links (concept of Id).
But complete synchronizations can be very heavy if the amount of links is big. For example: if we have a database of 500 links, with 1 or two updates per week, if we always run a complete synchronization we will download 500 links, only to update 1 or 2 links !
Conversely, the incremental synchronization will manage only the updated or added links. But this kind of operation is more risky if we speak about data integrity.
We cannot use only one method: the complete mode is mandatory during the first synchronization, and it’s better to use incremental mode for the next synchronizations, in order to decrease the workload required.
If we want to automate the synhronization, we could develop a plugin. To do that, we need to know how to
- read or export the links of Delicious,
- read or export the tags and/or the bundles of Delicious,
- get the links of WordPress,
- add / update or delete links in WordPress,
- schedule the synchronization script
We have now clear requirements. In the next posts, we will study the tools / API required to code this synchronization.