I came across an interesting dilemma of UI and back-end design. Most blogs use an address slug similar to ‘http://url.com/year/month/day/post-title-as-slug’. Part of my design was to create this automatically from the title once the creation form has been submitted. So what happens when we edit the title of this article? Do we change the slug or not?
If we change the slug, we lose the original address. If word has got round and many people are now linking to your post, you’ll lose all those visitors. It’s a bit like your zip code changing just because you painted your house a new colour. A solution to this would be to keep the slugs in a separate table from the blog posts, so that old slugs remain, and new ones are added. In this way old versions of a slug will still point to the now updated article. This does however involve a lot of unnecessary complication.
If we decide not to update the slug, it will be out of date, and perhaps not tie up accurately with the title. This is a minor flaw, as it is unlikely that a title would undergo a major change. We can show the user what the slug will look like using a quick bit of javascript in the UI, and tell them that they can’t change it in the future. This seems a nice way around an otherwise complex problem, and is going to be the approach I will take. To allow the article title and slug to be changed right up to the point it is published, I won’t generate a slug until the post leaves the draft state.
It may be nice to have the option to edit the slug manually, that’s something that could be definitely be implemented as an advanced admin feature. This is something that Dolphinling has been talking about with regards to Wordpress.