Lalabobo.net

Present now

jra_alias_urls textpattern plugin · 25 October 2010, 15:58 by Jean Rajotte

This textpattern plugin allows you to assign an arbitrary number of alias URLs to articles.

The motivation for this plugin came from wanting short URLs in print media to reference articles with complicated URLs. What if, in a newsletter, we could say:

To read more, see: http://iicph.org/2010/a

instead of

To read more, try to type this accurately in your browser: http://iicph.org/review-the-woman-who-knew-too-much

and still get there?

The plugin source is here

The help explains the simple steps and the performance issues. In a nutshell:

  1. Dedicate a custom_X field to article alias URLs.
  2. Put the plugin tag 1st thing in the default_error page.
  3. Write the alias URLs in the field in articles following the simple rules.

The plugin uses a slowish LIKE SQL query, but it only happens when there’s a 404, and only happens once per article per browser as the HTTP 301 redirection should get cached.

I looked at the zem_redirect plugin for inspiration.

 
Jean Rajotte · 25 October 2010, 18:16 · #

Soon after I put this plugin at textpattern.org, someone pointed me to an alternative plugin: smd_short_url which provides similar functionality in a simpler, faster way. A little less flexible, maybe, than my plugin, but simpler I think is better. Thanks for the pointer, Markus.

Add a comment

Textile Help