Inspired by a little IRC chat with Ben Ramsey, I decided it shouldn't be that
hard to patch up custom permalink support into serendipity.
The foundation was already there, thanks to Tom. What I did was patch up all
functions and plugins that use the serendipity_ArchiveURL() function.
I created a lookup database table for entries, since users may be able to build
a URL layout that does not contain the Entry ID. Only if no entry id is
contained in the URL, a DB lookup will be made; thus if people stay with our old
archives/ style links, they will not feel much of a performance impact.
A hard thing to do was that the archiveURL() function now needs the timestamp
value of an entry so that you can build /archives/2005/10/05/title.html.
I have only tested the basic functionality, and it seems to work pretty well.
Please review the attached patch for Serendipity 0.9 SVN - if nobody disagrees
until the next days I will commit the patch to SVN. Feedback is appreciated, of
It currently ONLY works for the entries archive. The Pattern for past archives,
categories and feeds I have not yet touched because it's less important IMHO;
and the funcionality to implement it is all there, it just needs a volunteer.
But for migrating WordPress articles and leaving the articles Permalink, the
patch is suitable. (You'll need to import your wordpress articles first, and
then change the permalink structure in s9y configuration to the WordPress one)
As I checked back with Tom Sommer, we thought about if it's a clever way to have a seperate lookup table for the permalinks. Advantages for this lookup table are:
- faster performance as it's a smaller table with optimized indices
- flexible approach as all kinds of categories, feeds, authors etc. permalinks can be handled there as well
- you can store more than one entry on the same day with the same title
- needs a new table
- the lookup table needs to be synchronized when updating/creating entries or changing the permalink syntax (the synchronizing is already taken care of in my patch)
Other blog systems do not use a seperate lookup table - so is our uniqueness here clever or are we doing something wrong the others found out about? :-)
[Update: I updated the links above to include a minor bugfix in the .diff file]