Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-12-22 16:11:15

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Date-based URLs, timezones, $permlink_mode & custom_url_func

I really do like date-based URLs: they make sense when you see them and can endure category- and section-related changes by us indecisive types.

I have been writing a custom plugin to migrate my site’s URLs to a new format and preserve/redirect seamlessly. However, I have run into a bit of a bump when I realized that by having the day in a URL, you create a point-of-failure by making URLs timezone-dependent:

  • If I were to move to Australia and change my timezone in prefs, using /yyyy/mm/dd format, the dd in many of my URLs would change because of the large time shift. This effectively breaks permalinks.

I’m thinking that the most stable format (which currently doesn’t exist) would be /YYYY/mm/url-title (aka “year_month_title”), that way you’d only run into the possibility of date-related problems one day per month and the likelihood you’d post the same URL-title twice per month is fairly slim.

Anyone else in favor of the addition of this URL format? That being said, anyone have experience in writing a custom_url_func for something like this?

Last edited by Andrew (2006-12-22 16:31:12)

Offline

#2 2006-12-22 16:40:09

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: Date-based URLs, timezones, $permlink_mode & custom_url_func

Also, is there currently a writeup anywhere for how to create a custom permlink_mode? Is it even possible?

Basically, what I’m looking to do is to take any request that doesn’t match my current permlink_mode and 301 permanently redirect to the appropriate URL. And ideally I’d be able to redirect it to a permlink_mode of my creation, but I’d settle for year_month_day_title.

Offline

#3 2006-12-22 18:00:36

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: Date-based URLs, timezones, $permlink_mode & custom_url_func

I’ve been messing around with zem_redirect, but that plugin appears to have some problems. Any ideas on permlink_mode migration?

Offline

#4 2006-12-23 01:44:10

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: Date-based URLs, timezones, $permlink_mode & custom_url_func

Not sure if this is what you’re after, but the venerable sgb_url_handler would let you create the custom date format you’re looking for.

Permalinks, I dunno.

Offline

#5 2006-12-23 17:18:28

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: Date-based URLs, timezones, $permlink_mode & custom_url_func

I do see some mention of the /year/month/title format, but sungodbiff’s last post was well over a year ago and that forum thread ends in numerous pages of user issues, telling me that plugin is probably no longer in active development.

Offline

#6 2006-12-23 17:28:12

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: Date-based URLs, timezones, $permlink_mode & custom_url_func

Here are the things I wish to accomplish:

  • Extend Textpattern to allow for /year/month/title (via plugin)
  • 301 redirect to the new (custom) URL format any 404s matching the old URL format

Offline

#7 2006-12-23 17:54:20

graeme
Plugin Author
Registered: 2004-06-21
Posts: 337
Website

Re: Date-based URLs, timezones, $permlink_mode & custom_url_func

All the above is possible with gbp_permanent_links

Offline

#8 2006-12-23 18:00:44

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: Date-based URLs, timezones, $permlink_mode & custom_url_func

Fantastic, I’ll check it out. Dunno how this little gem slipped by me :)

Offline

#9 2006-12-23 19:47:43

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: Date-based URLs, timezones, $permlink_mode & custom_url_func

Andrew wrote:

I do see some mention of the /year/month/title format, but sungodbiff’s last post was well over a year ago and that forum thread ends in numerous pages of user issues, telling me that plugin is probably no longer in active development.

Yep, you’re right it’s an oldie. But it does pretty much handle any url scheme you can think of. And I haven’t had a problem with it yet.

Been too lazy to try Greame’s excellent sounding plugin, but Gol Darn, I’m gonna check it out right now…

Offline

Board footer

Powered by FluxBB