When I made the big jump from WordPress to ExpressionEngine this past spring, I dumped all my old posts. There were many reasons for the decision, and one of them was that I couldn't figure out an easy way to migrate the URLs for existing articles over to the new system. Granted, it wasn't the biggest of reasons, but it didn't help.
The year/month/day permalinks that WP helped popularize are great, especially when you hold them up to the standards presented by Tim Berners-Lee. They're descriptive of the content, and in systems like WordPress, they can be made hackable with very little effort. (You could, for instance, remove the title, and have an archive page serve up a list of all posts for that day. Hack off the day, and the same template could serve up all the posts for that month. You get the idea.)
While ExpressionEngine doesn't serve up nice date based URLs by default, it turns out it can be done. In fact, it's quite easily accomplished.
I love it when developers get all transparent with their process.
Adam Kanh, the developer behind the conversion of Khoi Vinh's Subtraction from Movable Type to ExpressionEngine, deserves all of the credit for this little trick. It's immensely helpful when a developer lays out their templates, regardless of what language they're written in, for all the world to see. In all those lines of code, here's the piece I was most interested in:
- <h4><a href="{path={entry_date format="%Y/%m/%d"}}{url_title}">{title}</a></h4>
The thing about ExpressionEngine is some template tags – like entry_date – get processed really early on in the rendering process. That means you can nest them inside tags that get rendered later on – like the path tag. All we're doing in this little snippet is making a path out of a formatted entry date string and then appending the title of the post to the end. The resulting permalink should look familiar to WordPress users and consumers:
- http://thenestedfloat.com/2008/10/06/crazy-awesome-post
From here, you've got all sorts of options for writing and arranging templates that handle this URL in a friendly, hackable way. I'll describe one such option here soon, but you may also find that Adam's solution, linked above, is just what you're looking for.






Comments
December 8, 2008
6:42 am
January 3, 2009
6:26 pm
February 2, 2009
6:51 am
March 13, 2009
9:13 am
August 26, 2009
4:59 am
December 14, 2009
7:16 am
January 3, 2010
8:03 pm
January 21, 2010
6:29 am
February 10, 2010
7:43 am
February 11, 2010
6:45 am
February 12, 2010
2:25 am
February 12, 2010
2:32 am
February 23, 2010
3:07 am
March 29, 2010
1:38 am
March 30, 2010
4:46 am
March 31, 2010
9:45 am
March 31, 2010
11:30 pm
April 1, 2010
10:22 am
April 1, 2010
12:33 pm
April 4, 2010
2:18 am
Whaddya think?