Thursday, April 12, 2007

How to make Amazon Context Links work in your Blogger blog

I had an uncomfortable time tearing my hair out with this problem. I followed the instructions to the letter yet cannot make it work. I even wrote Amazon about this but despite their prompt reply, it wasn't too helpful.

After analyzing the source code and putting my unmeasurable brain power to the task, I finally figured that Amazon needed the information in the comment tags as well (the details between the comment tags were not showing under "View Source"). After all, the JavaScript script we are calling is a general one and they needed our affiliate ID. If it doesn't show on the source code, it will likely not work properly. It would actually be worse if it works since purchases will be made because of our site but we won't get the proper credit. :P

So why won't the comments show? I tried a simple <!-- This is a comment. --> html test and to my surprise, it didn't show up in the source code as well. It struck me then that the template was in xml format and not the plain vanilla html. After doing some research, I realized that there are some special characters in xml that cannot be used in normal xml strings. I found at least 5. Namely, they are &, <, >, " and '. So it seems that for them to be used properly, we need to use their unicode versions.

So if you need an ampersand &, use &amp; instead. If you need a left angular bracket <, use &lt; instead. If you need a right angular bracket >, use &gt; instead. If you need a double inverted comma ", use &quot; instead. If you need an apostrophe ', use &#39; instead.

If you don't want to go through the hassle of changing it one by one, a nice person by the name of B.Suter has put up a free online converter at http://www.stanford.edu/~bsuter/js/convert.html that you can utilize. Note though that the form works for the 2 angular brackets only. After all, these are the ones usually causing the problem.

So there, I went to my Template >> Edit HTML in blogger (beta) and pasted in the modified code for Amazon Context Links. The context links show up just fine now. ^^


The Hunger Site The Child Health Site The Breast Cancer Site The Animal Rescue Site

0 comments: