I apologize in advance to everyone who subscribes to my blog's RSS feed, but this week your RSS reader is probably going to suddenly find 25 "new" posts from me.
My blog currently uses
/blog/title as the URL scheme, with similar URLs for categories and tags etc. Soon, I'm probably going to change it to
/blog/123/title, as part of the impending release of version 0.2 of my blog engine. (The code-in-progress is in a branch on github, for the daring and foolish among you.)
This way, I can change the title of a post without breaking everything. I have heretofore lacked this ability. It's easy to code, you just tell Compojure to ignore everything after the number in a route. Something like this:
(defroutes foo (GET ["/blog/:id:etc" :id #"\d+" :etc #"(/[^/]*)?"] [id] (pages/post-page id)))
It's only a few lines of code to change, but the ramifications are widespread. It'll instantly break every link to my blog, for example. At least it's pretty easy to set up a bunch of redirects in Compojure to avoid that. I think this'll work:
(require (blog [db :as db] [link :as link]) (oyako [core :as oyako]) (ring.util [response :as response])) (defn redirect-post [name] (when-let [post (oyako/fetch-one db/posts :url name)] (response/redirect (link/url post)))) (defroutes redirect-routes (GET ["/blog/:name" :name #"[^/]+$"] [name] (redirect-post name)))
(Oyako here is the experimental ORM-like library I'm using to interface with PostgreSQL nowadays, having ditched Tokyo Cabinet.)
Changing my URL scheme is also going to mess up RSS though, because I (foolishly) used post URLs as the GUIDs in my RSS feed up to this point. This problem I don't know how to avoid. I might reduce the number of posts included in my feed temporarily, to limit the damage.