Translate

Saturday, January 20, 2007

Automatically Add Social Bookmarking Links

Share
For the past couple of months, I have been trying to find a way to automatically add social bookmarking links (such as DiggIt and del.icio.us) to my posts. Finally after much searching, I found instructions on how to modify my blogger template. You can find the instructions at here. I only ran into one problem when I saved my modified template. Blogger reported "...element type "h3" must be terminated ..." the fix for this is to remove the statement that is just before the Statement. Clear as mud right? If you follow the article it's relatively easy. I had to read the article twice before I made changes. And as I worked with my template code I realized what they were talking about. To help you, here's my code before the change (the lines in red is the "data:post.link" that TekArtist's article is refering to):
  <h3 class="post-title">
<b:if cond="data:post.link">
<a href="data:post.link"><data:post.title></data:post.title></a>
<b:else>
<b:if cond="data:post.url">
<a href="data:post.url"><data:post.title></data:post.title></a>
<b:else>
<data:post.title>
</data:post.title>
</b:else>
</b:if>
</b:else>
</b:if>
</h3>

and here is what I changed (the '<!--' and '-->' are used to comment out section of HTML code and are ignored by the browser):
     <h3 class='post-title'>
<!-- commented out to ensure no conflict with the default template behavior for the link data.
<b:if cond='data:post.link'>
<a expr:href='data:post.link'><data:post.title/></a>
<b:else/>
-->
<b:if cond='data:post.url'>
<a expr:href='data:post.url'><data:post.title/></a>
<b:else/>
<data:post.title/>
</b:if>
<!-- comment out because of the previously commented out section above this
</b:if>
-->
</h3>
</b:if>


After you have made all the changes recommended by TekArtist, you can add more social bookmark links. I found the code for many of them listed here at Myo Kyaw Htun's site. Let me know how this works for you and if you need any further clarifications.

3 comments:

stephdau said...

Hi there. I'm the author of the page you refer to on tekArtist. Just to let you know that I recently updated the page to clarify the H3 manipulation part you were having problems with. Cheers.

stephdau said...

Also, you didn;t have to modify the H3 stuff to just add the "bookmark bar". That's specifically to add the interactive Digg button.

Anon A. Mus said...

Thank you, Stephdau, for writing and clarifying this post!