An unexpected feature

As I was writing the link to RFC-2045 [1] in the previous post [2], an idea suddenly struck me—why should I have to type out the entire URL (Uniform Resource Locator)? I already have a shortcut to link to Amazon [3] (all I have to do is write a link like <a href="asin:B00BWQW73E"> and mod_blog converts it to <a class="book" href="http://www.amazon.com/exec/obidos/ASIN/B00BWQW73E/conmanlaborat-20">) so it shouldn't be that hard to add.

I was fully expecting it to take maybe fifteen minutes or so to add the code, but to my surprise, no code change was required! The configuration file [4] has this bit:

>
```
affiliate =
{
{
proto = "asin",
link = "http://www.amazon.com/exec/obidos/ASIN/%s/conmanlaborat-20"
}
}
```

It was originally intended for affiliate links, but it'll work for this as well. A slight modification:

>
```
affiliate =
{
{
proto = "asin",
link = "http://www.amazon.com/exec/obidos/ASIN/%s/conmanlaborat-20"
},
{
proto = "rfc",
link = "http://www.ietf.org/rfc/rfc%s.txt"
},
}
```

Now all I have to do is write <a href="rfc:2045"> and mod_blog will convert it to <a href="http://www.ietf.org/rfc/rfc2045.txt">. I love it when stuff like this happens.

[1] https://www.ietf.org/rfc/rfc2045.txt

[2] /boston/2014/04/26.1

[3] https://www.amazon.com/exec/obidos/ASIN/B00BWQW73E/conmanlaborat-20

[4] /boston/2011/11/28.1

Gemini Mention this post

Contact the author