Mimicking WordPress’ Date-Based Permalinks in ExpressionEngine

Oct. 6, 2008

5:01 pm

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:

  1. <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:

  1. 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

Matt,

I was referred to you by Nick P. and would like to see if you are interested in a site conversion/re-design project.

Thanks
Jim

Jim Caton (#)

January 3, 2009

6:26 pm

This is a very interesting transition. I have a small blog myself, but I keep it as a secret until I manage to sort everything out. Are you truly happy with expressionengine instead of Wordpress? I’ve heard many opinions and the advantages which you have presented are definitely a plus. Thank you for the post!

Sue MLM Leads (#)

February 2, 2009

6:51 am

Nice tip about permalinks. It inspires me much though I’m sticking on Wordpress.

EZwpthemes (#)

March 13, 2009

9:13 am

discount flights and hotels. in the attached ought to Is the .cheapest plane tickets .discounted airline fares i’m with cheap last minute airlines tickets whether or no tickets to fashion week outside singapore ticket eastern china airlines take us air travel tickets .follow discount flights to hawaii could If when flights from portland, or to kettering oh stuff cheap airline tickets to honolulu .Usualy discount travel sites Links Whith stuff ticket to italy .

Accoxia (#)

August 26, 2009

4:59 am

A schoolma’m being hailed as a protagonist said Tuesday he had no era to over when he encountered a 17-year-old guy who detonated two quieten down bombs at a Northern California squeaky alma mater while armed with a chain saw, sword and explosives.

Professor Kennet Santana, 35, is one of a number of Hillsdale Excessive Creed staffers credited with subduing the youngster, who watch state walked into buy viagra cialis online the San Mateo public school Monday morning and set off two calumet bombs in a hallway close to a library.

Georkesse (#)

December 14, 2009

7:16 am

Your work is fantastic looking, the site is a snap to navigate… Consider me a fan!

thai silk (#)

January 3, 2010

8:03 pm

I’m curious why you switched to ExpressionEngine. I have a blog and use WP. There are so many plugins that you can do about anything you want with it. Are there some advantage that I’m missing? Instead of dumping the old posts you could use a 301 redirect from the old URL to the new URL. The 301 shows that the page was move permanently. You still keep all the backlinks, pr, and search engine rankings.

leads (#)

January 21, 2010

6:29 am

EE is really new to me and the sound of it is really cool… Maybe it’s time to take it a test.. Thanks for posting this guide.

SEO Training (#)

February 10, 2010

7:43 am

I admire the time and effort you put into your blog and detailed information you offer! I will bookmark your blog and have my children check up here often. Thumbs up!
PPC Montreal

Abbott (#)

February 11, 2010

6:45 am

Wow, I wished I had found your blog a few years ago. This is a battle I have been having for most of my life....I’m going to go grab a cup of tea and continue reading some more....
US auto insurance directory

Abbott (#)

February 12, 2010

2:25 am

I was in the military for four years and I still have a hard time getting up early. But now I don’t have a drill sergeant turning the lights on and yelling at me either.
Jumping Castle

Abbott (#)

February 12, 2010

2:32 am

I was in the military for four years and I still have a hard time getting up early. But now I don’t have a drill sergeant turning the lights on and yelling at me either.
beer coasters

Jorge (#)

February 23, 2010

3:07 am

I totaly agree with your point here! I admire the stuff you post and the quality information you offer in your blog! Keep up the awesome work dude.
wedding stubby holders

Ashley (#)

March 29, 2010

1:38 am

hello, i love wordpress

justin tv (#)

March 30, 2010

4:46 am

@justin tv
I love too :)

Turkish Grand Prix (#)

March 31, 2010

9:45 am

Thank you very nice :)

Online-İzle (#)

March 31, 2010

11:30 pm

Permalink is the best function on Wordpress!

True Blood (#)

April 1, 2010

10:22 am

ooooooooooooooooo buda güzel

parti testi (#)

April 1, 2010

12:33 pm

Good article! Very thanks!
et makinası

et makinaları (#)

April 4, 2010

2:18 am

kardeş valla süpersin ya sende olmasan googlede nasıl yükseliriz bilmiyom ha

yeni oyunlar (#)

Whaddya think?