Saturday, January 06, 2007

"Subscribe Feed" Blogger Widget

This is my first widget written using the HTML widget type. It just a simple widget for users to easily provide buttons to several popular feed subscription site.I've been trying to use the add-widget form provided by Blogger, but it seems like the widget.template input couldn't accept input other than <data:content>. I think this is a bug and I've reported it. (Due to this bug, I think the next "Hacking Blogger Widget" post will be halted for a while)

Adding the widget into the template is easy. Open edit template html page, check expand widget, then copy the codes below, and paste it after another widget. Save the template and you're done. To rearrange the widget, just use the 'Page Elements' page.

After adding into your template, goto 'Page Elements' and click the edit button at the widget. Put your feed url into the widget content form. Be careful not to put any line breaks or other characters because it will go into your url.

Preview


Subscribe in NewsGator Online Add to GoogleSubscribe in Rojo Add to Newsburst from CNET News.com Subscribe in FeedLoungeAdd to netvibes Subscribe in Bloglines Add to My AOL




And this is the code
<b:widget id='HTML12' locked='false' title='Subscribe Feed' type='HTML'>
<b:includable id='main'>
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<a expr:href='"http://add.my.yahoo.com/rss?url=" + data:content'><img alt='' src='http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif' style='border:0'/></a>
<a expr:href='"http://www.newsgator.com/ngs/subscriber/subext.aspx?url=" + data:content'><img alt='Subscribe in NewsGator Online' src='http://www.newsgator.com/images/ngsub1.gif' style='border:0'/></a>
<a expr:href='"http://fusion.google.com/add?feedurl=" + data:content'><img alt='Add to Google' height='17' src='http://buttons.googlesyndication.com/fusion/add.gif' style='border:0' width='104'/></a>
<a expr:href='"http://www.rojo.com/add-subscription?resource=" + data:content'><img alt='Subscribe in Rojo' src='http://www.rojo.com/corporate/images/add-to-rojo.gif' style='border:0'/></a>
<a expr:href='"http://www.newsburst.com/Source/?add=" + data:content'><img alt='Add to Newsburst from CNET News.com' height='17' src='http://i.i.com.com/cnwk.1d/i/newsbursts/btn/newsburst3.gif' style='border:0'/></a>
<a expr:href='"http://my.feedlounge.com/external/subscribe?url=" + data:content'><img alt='Subscribe in FeedLounge' border='0' src='http://static.feedlounge.com/buttons/subscribe_0.gif' title='Subscribe in FeedLounge'/></a>
<a expr:href='"http://www.netvibes.com/subscribe.php?url=" + data:content'><img alt='Add to netvibes' height='17' src='http://www.netvibes.com/img/add2netvibes.gif' style='border:0'/></a>
<a expr:href='"http://www.bloglines.com/sub/"+data:content' type='application/rss+xml'><img alt='Subscribe in Bloglines' src='http://www.bloglines.com/images/sub_modern11.gif' style='border:0'/></a>
<a expr:href='"http://feeds.my.aol.com/add.jsp?url=" + data:content'><img alt='Add to My AOL' src='http://myfeeds.aolcdn.com/vis/myaol_cta1.gif' style='border:0'/></a>
<br/>
</div>
<b:include name='quickedit'/>
</b:includable>
</b:widget>

You might need to adjust the div id to make it compatible with your theme. Also, the widget id must be a unique id. If theres other widget in your template with the same id, put a different id for this one.
Post a Comment