Monday, March 30, 2009

DNN Internal Syndication - Branding Syndicated Content

by Phil 'iwonder' Guerra - (Avondale, MO) - As you’ve probably seen, the latest versions of browsers provide a quick interface to syndicate newsfeeds and present them with just a few clicks of a button. It’s a nice feature, and for those folks that don’t want to use a stand-alone news reader, it offers a quick link to keep up with their favorite web sites. The one problem with using a browser to present a news feed is most do not support use of your site’s Channel details to be rendered. That’s an unfortunate situation, as it takes away one of the primary reasons for creating syndicated content. No doubt many companies would like their company icon and a brief note about what they offer, displayed with their syndicated content. However, browser technology is deciding what to render, whether you like it or not, and your site's channel details are often left out. The end result is you may be missing out of a marketing opportunity to brand your syndicated content when it is used with browsers.

Using Microsoft’s Internet Explorer and Apple’s Safari, you get a feed rendered, and only the Channel Title is displayed. With the FireFox browser, you may get the site title and description. So, what can you do about the situation?

The simple solution with DNN is to always include an entry that contains that information. However, that approach may not be possible if the module you are syndicating doesn’t give you an opportunity to do it. This simple solution may be impractical depending on how many module instances you have that offer syndicated content because you have to add an entry item for each one. Implementation of internal syndication varies by DNN module, so there is no one set way to achieve the solution.

Another approach that I took involves adding a bit of code to the DNN core, RSSHandler.vb. You’ll find this code in the /Library/Services/Syndication folder, with DNNv5.0.0. The bit I’ve added calls a simple routine to always add an item to syndicated content, which includes the Portal title, description, and you could add graphics if you choose to do it. Now, when a users clicks the syndicate icon, and their browser renders it, they will get the Site branding displayed as a newsfeed item.

The code I’ve added may not be best practices, but it’s working for me, and the client is happy, and that’s the most important item of all. Here’s the code, and note after you’ve added it, you can just choose to build the library from VS2005 or VS2008 to implement it. I place the call to the routine right about the line that checks searchResults, this way I always add my site branding item, even if there are no other items available. In fact, RSS v2.0 specifications state that there should always be at least 1 item in a feed, so this makes DNN internal syndication more RSS v2.0 compliant.

Channel.Items.Add(AddSiteBranding())

If searchResults IsNot Nothing Then….

Next, the routine that adds the site branding item:


Private Function AddSiteBranding() As GenericRssElement

Dim item As GenericRssElement = New GenericRssElement()
item("title") = GetPortalSettings.PortalName
item("description") = GetPortalSettings.Description
item("link") = AddHTTP(GetDomainName(Request))
item("pubDate") = Now().ToUniversalTime.ToString("r")
item("guid") = AddHTTP(GetDomainName(Request))
Return item

End Function

Now, be sure that you add only item tags that match what the feed is already adding to maintain consistency in your newsfeed. The result gives you a syndicated feed that displays your Portal Name, along with the Description of your portal. Now, when folks syndicate it in a browser, you’ll have a bit of a marketing edge always available. I’ve thought of some other variations of this type of branding, including adding some database items and using a routine to fetch items randomly. Otherwise, what is being displayed actually comes from your Portal’s information. Hopefully, you are using the Host Administration page to add your portal description, which is the source for this information. You can even add an image to the Portals description textbox to add more branding to your feed.

Here’s what an example implementation looks like in IE8, the first item in the feed is the branding item.






Of course, you might want to make the other core code changes I’ve mentioned in previous installments on my blog to get other enhancements. I use a slightly modified version of the Announcements v4.0.1 and vw_Search SQL view in conjunction with this change.

No comments:

Post a Comment