Autolink Plugin

10/28/2005 19:39:19
tags: blosxom, web

I have written my first plugin for Blosxom. It is inspired by dictionary, a plugin by Gregory Bair.

Download plugin:

This plugin is used to create links for words that you use commonly. For instance, if you frequently used the word Macintosh, and wanted it to link to Apple Computers website, it would be painful to have to do this manually every time you used the word.

With the Autolink Plugin, you don’t have to. You create a single autolinks reference file that consists of all of the words you want automatically linked. for instance:

Macintosh=http://apple.com/

By default this file is called autolinks, and is placed in your Blosxom data directory, but this can be configured within the script itself.

But wait! That’s not all. You can also use regular expressions within your autolinks file if you want to match several closely related terms with the same URL. For instance:

Fletcher(\s+Penney)?=http://fletcher.freeshell.org/

The above string would match my first name by itself, or my first and last name together.

Not bad, huh? Also, I have tried to avoid modifying words within urls (that can get messy) Currently, a space is required in front of the word you are trying to match. A space, period, comma, semi-colon, or exclamation point is required after the word (or phrase). I am going to improve this aspect of Autolink soon, and am open to suggestions.

If you wish to turn off autolink in a particular story, you can insert a comment in the source:

Please try it out and give me feedback so that I can improve it and make it more useful!

Similar Pages