Re: Pyblosxom permalinks are not permanent

will <[email protected]> Mon, 20 Jul 2009 09:51:07 -0400
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
seanh wrote:
> On Mon, Jul 20, 2009 at 2:11 PM, seanh<[email protected]> wrote:
>> I dunno, feels inelegant. Perhaps keeping categories fixed is better.
> 
> I noticed that in wordpress if you change the unique slug of a post
> and then visit the old slug you get re-directed to the new one. I
> wonder if you could do something like that in pyblosxom? Use
> categories+filename as permalinks but if you move a post leave a file
> behind with an HTML redirect in it.

Off the top of my head, I think there are a few ways you could solve the 
moving categories problem:

First is to use a version control system for keeping track of entries in 
your blog.  I think there are a couple out there already that use the 
checkin time for the mtime for a file.  If the version control system 
knows about file moves, then you could write a plugin that checks the 
version control system and provide the redirects.

Second is to write a shell script that moves a post from one category to 
another and make sure you only use that shell script for moving posts. 
It'd move the post but also add an entry to some redirect-index file. 
Then write a plugin to check that file for redirects and provide as 
needed.  You mentioned the problem where moving a file a few times 
provides multiple redirects, but I think you could squash multiple moves 
into one move in the plugin without having to do multiple redirects.

Alternatively, I think it's probably easier in the long run to give each 
entry a unique identifier and use the unique identifiers as the 
permalink.  Then you have a cron job that compiles all the unique 
identifiers into an index file that's read by a plugin whenever a 
permalink slug is requested.  Maybe hashing the original 
category/filename/title is a good unique identifier?  So long as you 
store it in the metadata of the entry and it stays the same, it probably 
doesn't matter what the original composing criteria is.

/will

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge