posted by: Ralf Rottmann | posted @ Thursday, September 13, 2007 6:08 PM | View blog reactions

Last year Technorati introduced the Link Count Widget which provides the ability to add a link to your blog's posts which dynamically indicates how many other (Technorati listed) blogs link back to each of your own posts.

By simply adding two lines of HTML and JavaScript markup you would end up indicating links to your posts like that:

image

I could not find any prepared code for Subtext on the Technorati website, so I had to do it myself.

So if you want to show Technorati blog reactions with your posts, here is what you could do:

I assume that your homepage uses the Day.ascx user control to render individual posts and all other lists user ViewPost.ascx. Because Day.ascx makes use of an ASP.NET Repeater the mechanisms are slightly different.

Please note that the code markup below might display line breaks when viewed in a browser. Unless explicitly indicated there are obviously no line breaks in the middle of any code.

Day.ascx

In Day.ascx wherever you want to display the Technorati blog reactions link add the following markup:

 1: <script src="http://embed.technorati.com/linkcount" type="text/javascript"></script>
 2: <a class="tr-linkcount" href="http://technorati.com/search/<%= Config.CurrentBlog.Host %><%# DataBinder.Eval(Container.DataItem, "url") %>">
 3: View blog reactions</a>

Essentially this links back to the Technorati URL http://technorati.com/search/ and adds the hostname of your blog (Config.CurrentBlog.Host) without the preceding "www" and the friendly URL of the current post (DataBinder.Eval(Container.Datatem, "url")).

Please note that in order to use Config.CurrentBlog.Host you've got to register the appropriate namespace within the user control. Simply add the following ASP.NET directive below the last Register directive in Day.ascx:

 1: <%@ Import namespace="Subtext.Framework.Configuration" %>

ViewPost.ascx

This user control is a bit more straight forward as we are not bound to the context of an ASP.NET Repeater. Let's first add the Subtext.Framework.Configuration namespace as we did for Day.ascx, too:

 1: <%@ Import namespace="Subtext.Framework.Configuration" %>
 
Wherever you want the Technorati blog reactions link, add the following piece of code:
 1: <script src="http://embed.technorati.com/linkcount" type="text/javascript"></script>
 2: <a class="tr-linkcount" href="http://technorati.com/search/<%= Config.CurrentBlog.Host %>

      
 3: <%= this.TitleUrl.NavigateUrl %>"
>View blog reactions</a>
That's it!

A behind the scenes note

What does the DataBinder.Eval(Container.DataItem, "url") in Day.ascx do, and why do we have to use it? The Day user control uses an ASP.NET Repeater to iterate through the elements of a list. ASP.NET Repeaters make use of data binding in order to bind a set of data to a collection. The Repeater iterates through the bound data. The previous statement uses reflection to resolve the value of the "Url" field bound to the Repeater. In case you downloaded the source code of Subtext, you can take a look at Entry.cs to find other helpful fields which you can evaluate, like Title, Id and FeedBackCount.

Note: I am pretty new to Subtext and there might be a much easier way to accomplish the same. If you know about a more elegant way, feel free to comment!

 

 

comments
Haacked stated:
# re: Technorati blog reactions and Subtext
Did you look at the ShareThisPost.ascx control? I thought we added some helper properties to the base user control that makes linking to the post easier.
posted on 9/13/2007 10:22 PM
Ralf stated:
# re: Technorati blog reactions and Subtext
I did and actually I use it. However, in the scope of an ASP Repeater as in Day.ascx I don't seem to have access to an Entry object.
posted on 9/13/2007 11:47 PM
Haacked stated:
# re: Technorati blog reactions and Subtext
I need to fix that. :)
posted on 9/25/2007 12:26 AM
utwuptwl stated:
# utwuptwl
utwuptwl
posted on 12/30/2007 10:18 AM
# Betting casino gambling links online.
Online casino gambling guide at gambling win com. Online casino gambling poker slot. Online gambling and casino reviews. Online casino gambling bonuses. Online casino online gambling. Online game gambling casino.
posted on 5/8/2008 10:52 AM
# Online casino gambling.
Online casino gambling.
posted on 5/17/2008 4:03 AM
# Propecia side effects fre.
Propecia. Does propecia thin hair out at first.
posted on 5/18/2008 5:34 AM
Casino bonus. stated:
# Casino bonus.
Casino bonus.
posted on 5/19/2008 3:37 AM
fdqaithb stated:
# fdqaithb
fdqaithb
posted on 6/28/2008 11:23 PM
order fioricet stated:
# order fioricet
order fioricet
posted on 7/1/2008 1:13 AM
premarin stated:
# premarin
premarin
posted on 7/1/2008 2:51 AM
zyloprim stated:
# zyloprim
zyloprim
posted on 7/1/2008 4:09 AM
generic prozac stated:
# generic prozac
generic prozac
posted on 7/1/2008 6:20 AM
# purchase hydrocodone
purchase hydrocodone
posted on 7/1/2008 7:35 AM
buy hydrocodone stated:
# buy hydrocodone
buy hydrocodone
posted on 7/1/2008 7:50 PM
gyvlsnki stated:
# gyvlsnki
gyvlsnki
posted on 7/2/2008 3:39 AM
yvadtfgy stated:
# yvadtfgy
yvadtfgy
posted on 7/2/2008 3:40 AM
esgic stated:
# esgic
esgic
posted on 7/2/2008 8:46 PM
buy tramadol stated:
# buy tramadol
buy tramadol
posted on 7/2/2008 8:48 PM
mtescmlz stated:
# mtescmlz
mtescmlz
posted on 7/3/2008 4:21 AM
buagsnan stated:
# buagsnan
buagsnan
posted on 7/3/2008 4:21 AM
losec stated:
# losec
losec
posted on 7/4/2008 9:40 PM
post your comment
Title *
Name *
Email
Url
Comment *  
Please add 6 and 8 and type the answer here: