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 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 = "";

         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.


 


Tomas Restrepo

Software developer located in Colombia.