O'Reilly logo

Amazon Hacks by Paul Bausch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Simplify Amazon Associate Links in Your Blosxom Weblog

Create an easier way to link to Amazon products with the ASIN plug-in for the Blosxom weblog application.

Blosxom (http://www.blosxom.com) is a full-featured weblog authoring tool written in a single Perl script. Its simplicity belies its many capabilities, and one of these is a plug-in interface that allows other developers to add features easily. Blosxom is popular among newcomers and hackers alike, and it’s not surprising that as of this writing there are well over 100 plug-ins available (http://www.blosxom.com/plugins).

Developer Nelson Minar has used Blosxom to create a fast way to link to Amazon products called ASIN. With the plug-in installed, you can use a special link syntax:

<a href="asin:insert ASIN">Link Text</a>

With this syntax, the ASIN plug-in creates a properly formatted link to Amazon with your associate tag. So, linking to Amazon Hacks while you’re writing your post might look this:

<a href="asin:0596005423">Amazon Hacks</a>

But it ends up on the site like this:

<a href="http://www.amazon.com/exec/obidos/ASIN/0596005423/ref=nosim/your  associate tag">Amazon Hacks</a>

If you’re posting about the latest book you’re reading or your favorite CD, all you need is the ASIN number, and the ASIN plug-in will format everything for you.

Even if you don’t use Blosxom, this method of quickly creating links can be added to other content management systems.

The Code

This script uses a regular expression to match the special linking ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required