Enabling FeedFlare on dasBlog

Link. April 15, 2006. Comments [2]. Posted in: Blogging

I spent some time last night fooling around with some of the options available from FeedBurner (which is an excellent service, by the way), and decided to enable the FeedFlare features. Doing so for your feed is trivial, since feedburner serves it with all done automatically for you.

FeedFlare.pngHowever, enabling it for your site does require you to add a <script/> tag to your item template. I implemented this fairly easily in the end (though it took me a while to figure out how) by creating a custom dasBlog macro. Here's the code for the macro:

//
// FeedFlareMacros.cs
//
// Author:
// Tomas Restrepo (tomasr@mvps.org)
//

using System;
using System.Web;
using System.Web.UI;
using newtelligence.DasBlog.Runtime;
using newtelligence.DasBlog.Web.Core;

namespace Winterdom.Commonality.Macros
{
   public class FeedFlareMacros
   {
      protected SharedBasePage _requestPage;
      protected Entry _item;

      public FeedFlareMacros(SharedBasePage page, Entry item)
      {
         _requestPage = page;
         _item = item;
      }

      public virtual Control FeedFlare()
      {
         const string scriptTag = "<script src=\"http://feeds.feedburner.com/{0}?flareitem={1}\" type=\"text/javascript\"></script>";

         string feedburnerName = _requestPage.SiteConfig.FeedBurnerName;
         if ( feedburnerName != null && feedburnerName.Length > 0 )
         {
            string script = string.Format(scriptTag, feedburnerName, HttpUtility.HtmlEncode(Utils.GetPermaLinkUrl(_requestPage.SiteConfig, _item.EntryId)));
            return new LiteralControl(script);
         }
         return null;
      }
   }
} // namespace Winterdom.Commonality.Macros

I then simply enabled it in the web.config file and inserted this into my blog template:

   <%FeedFlare()|FeedFlare%>

Not the most elegant solution, I'm sure, but it did the trick :). Seeing how Scott already went through this, I'm guessing a future dasBlog build might have built-in support for this stuff.

 



Sunday, April 16, 2006 9:44:49 PM (SA Pacific Standard Time, UTC-05:00)
Shiny. I'll check it in as a standard macro!
Scott Hanselman
Sunday, July 30, 2006 3:51:50 AM (SA Pacific Standard Time, UTC-05:00)
Argh, I wish this had been listed as a feature of the latest build. I went off and made one of these too.

http://www.jforsythe.com/jforsytheblog/2006/07/27/GotFeedburnerFeedflaresWorkingWithDasBlog18.aspx

I like yours though.
Comments are closed.

Syndicate

About

Tomas Restrepo is a software developer located in Colombia, South America. His interests include .NET, Connected Systems, PowerShell and lately dynamic programming languages. More...

tomasrestrepo @ twitter My Flickr photostream My saved links on delicious My Technorati Profile

email: tomas@winterdom.com
msn: tomasr@passport.com

View my profile on LinkedIn

MVP logo

Ads


Categories

Statistics

Total Posts: 1035
This Year: 105
This Month: 4
This Week: 2
Comments: 802

Archive

Other

Copyright © 2002-2008, Tomas Restrepo.

Powered by: newtelligence dasBlog 2.1.8139.823

Sign In