opinions and rants on software and...things
December 19, 2008
I've extracted the slug-related code from this blogging software and packaged it so that it should be easily-portable to any Google AppEngine application. I hope that it will be useful for anyone who needs to add nice human and search engine-friendly URLs to their app. It works like and is similar in spirit to my previously-released AppEngine mixin, taggable-mixin.
I'd like to encourage anyone who finds this useful -- or any who finds it to be a useless atrocity -- to leave questions, suggestions and feedback here. I will answer as quickly as I can.
December 17, 2008
I've just integrated my new AppEngine Datastore mixin class, sluggable-mixin. It adds the ability to associate a user-friendly slug with any datastore entity. Posts here are now referenced by slug rather than their lengthy and meaningless datastore ID string.
I'm going to release it as open source as soon as I can polish it up a bit and write some good documentation. I'm a stickler for good, thorough documentation and automated unit tests. The tests are done; although, they might not have as much coverage as I'd like. I'm hoping to get sluggable-mixin released before the New Year begins.
December 09, 2008
I recently decided that I didn't like the way that URLs on the blog were formatted. For example, the link to show the entry before this is:
/showpost?id=aglhZGFtY2Jsb2dyLQsSCUJsb2dJbmRleCIJYWRhbWNibG9nDAsSBFBvc3QiC2FkYW1jYmxvZzE2DA
and that is bad on a number of levels. First, the post-specific data is the AppEngine Datastore ID of the entity that holds the post. While it is usefully unique and a quick index to the data, it is also terribly ugly and utterly unhelpful to either human readers or search engines. It needs to be a slug. That's well-and-good, as I have been working on a Sluggable mixin class to go along with the two other tools in my CMS belt, Taggable and Commentable. I'll write more about Sluggable when it is ready to be released.
Secondly, the ID is passed in to the showpost handler as a GET parameter, and I'd rather have it be more RESTful, something like:
/showpost/acts_as_urlnameable-instructions
or even
/showpost/aglhZGFtY2Jsb2dyLQsSCUJsb2dJbmRleCIJYWRhbWNibG9nDAsSBFBvc3QiC2FkYW1jYmxvZzE2DA
since I don't have Sluggable ready. Now, it occured to me that it would be reasonably easy to change the code up to have the RESTful-style URLs, but then I would be breaking any existing links to posts ...
read more