Re: Pyblosxom permalinks are not permanent

seanh <[email protected]> Sat, 8 Aug 2009 22:22:35 +0100
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
On Mon, Jul 20, 2009 at 2:51 PM, will<[email protected]> wrote:
> seanh wrote:
> 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.

I actually use git to track the files in my blog already, although I
don't integrate pyblosxom with git at all. What you suggest wouldn't
work though, git doesn't always know when you move a file. If you both
edit and move a file in the same commit and forget to use git mv, then
often git records it as deleting the file and adding a new one. Ok,
you could just not do this, it's bad behaviour, but I've been using
VCS's to track my personal notes for years and I always do this sort
of thing, so I know I can't rely on myself.

I've had a change of heart about this whole issue after reading an
article by Cory Doctorow about how he used tags to index a large
collection of notes:
http://www.locusmag.com/Perspectives/2009/05/cory-doctorow-extreme-geek.html
(see 2. Research: Twitter meets notekeeping)

I used to prefer pyblosxom categories over the tags plugin because
they seemed more core to the pyblosxom way of doing things (use the
filesystem). But now I think paths should be used as permalinks only,
paths are what make sense as permalinks in pyblosxom and conversely
permalinks are really all that paths are good for. As a means of
organising and browsing your posts paths are really brittle and
inflexible: permalinks break, a post can only be in one category at a
time, the category views only show the first n posts in the category
anyway (although I think this got fixed for 1.5).

I've realised that tags are much better for categorising because
they're so lightweight and flexible, the existing tag plugin works
well, tag pages show all posts with the tag, they don't break
permalinks when you change them, a post can have multiple tags. Tags,
if you pay attention to them and use them carefully, let you build up
an index of your site that facilitates a directed yet serendipitous
browsing (to paraphrase Cory).

But the problem with tags in pyblosxom (I've used them in the past) is
that they can easily become a mess, you end up with multiple different
tags for the same thing, often just slightly different spellings or
something, posts with no tags, and lots of tags you barely use. So I
think pyblosxom requires an additional utility to let you manage your
tags with care. I've already written this script but never really put
it to work, I'll have to dust if off to revive the tags for my notes,
so I'll try to post the source when I do. It's a nearly trivial
command-line program in python that walks your entries dir and can:

* Print out a list of all your tags and the no. of posts each tag has,
sorted by popularity or alphanumerically.
* Print out all the posts that have a particular tag or tags (you
could potentially allow AND, OR and NOT etc. but I don't know how
useful that would be)
* Print out all the tags that a particular post has
* Rename a tag
* Delete a tag
* Split one tag into two
* Join two tags into one

All of these operations require reading all of the files in your
entries dir, and the last few require modifying the #tags lines of
lots of files (e.g. when I say rename a tag, I mean rename that tag in
every entry file that it occurs in).

This script is a standalone module not technically a pyblosxom plugin,
and it's independent of the tags plugin, but it occurs to me that the
two could probably share much of their code.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july