Getting started with the OpenLinkz search widget - read these posts and get up and running

Setting up OpenLinkz OpenLinkz Simplified Changing Appearance of Links OpenLinkz Cheat Sheet

How to fix problems with Blogger and the AddThis widget

I have using Blogger as my blogging platform for over a year and a half and I had implemented the AddThis bookmarking widget within each post. I recently upgraded to the new drop-down widget. Suddenly, I began to see strange things happen to the layout of certain blog posts.

As it turns out, any post with an apostrophe or single quote within the title causes a problem with the AddThis Javascript. Basically, the title of a post is stored as a Javascript string variable. If there is an apostrophe or single quote in the middle of the variable, it generates an error related to unterminated strings. Unfortunately, it is not so uncommon to want to use apostrophes.

Luckily, it is easy to fix this by adding one line of code to the Javascript supplied by AddThis.

This is the way the code looks when I get it from AddThis (I have added some carriage returns to enhance readability):


First, change the single quotes around '<data:post.title/>' to double quotes as follows:


Then add the following line of code:


This approach removes the apostrophe in the title string.

This is not a perfect solution, but it will prevent your titles from being cut off when bookmarking. And most importantly, it won't cause any problems with your page layout. Just be sure not t0 use any double quotes in your blog titles.

Posted by TradeRadarOperator at 8/29/2008 04:36:00 PM  


You, my friend, just helped me out a GREAT deal. Many many thanks!!!

Bill Brewer said...
October 25, 2008 at 1:08 AM  

Post a Comment


Support our sponsors!
Close this ad panelX