X

Building Out Your Information Hub with RSS

In a recent post, we talked about building your own information hub for search engine marketing purposes. This provides two major benefits: first, sites that are very heavy in content that changes often tend to rank highly; and second, an information hub provides you with a way to guide search engine spiders to web pages you want them to find, which will generally link back to your main site.

But who has time to build and maintain TWO web sites?

There is a technology that can make maintaining an information hub much easier: RSS. RSS, which is generally understood to mean “Real Simple Syndication,” is an XML file that contains information about web pages that can be streamed to your web site. Any web site can publish an RSS file, and most sites that feature articles or blog posts do so. So this means you can “borrow” material from other web sites to feature on your web site. That is how you can build an information hub without actually creating all the content yourself.

So how do you use RSS? You are going to have to write some code for your web pages that can retrieve an RSS file and then get the information out of the file for use on your site. There are a lot of different ways to do this, partly depending on what server runs your site.

Following is some code that you can plug into an ASP site (which will generally run on a Windows/IIS server):

Set xmlHttp = Server.CreateObject(“MSXML2.XMLHTTP.3.0”)xmlHttp.Open “Get”, WebSiteURL, falsexmlHttp.Send()
RSSXML = xmlHttp.ResponseText

‘The above code retrieves an RSS file from the supplied URL (“WebSiteIRL”) into an XML object.

Set xmlDOM = Server.CreateObject(“MSXML2.DomDocument.3.0”)xmlDOM.async = falsexmlDOM.LoadXml(RSSXML)

‘The above code loads the XML data into a DomDocument object.

Set xmlHttp = Nothing
‘ clear HTTP object
Set RSSItems = xmlDOM.getElementsByTagName(“entry”)
‘ collect all “items” from downloaded RSS
Set xmlDOM = Nothing ‘ clear XMLRSSItemsCount = RSSItems.Length-1

‘The above code gets the “entry” elements in the XML file into an array of items.

For i = 0 to RSSItemsCount
For each child in RSSItem.childNodes

‘Do something with each child node
‘For example, if there are nodes called “title”, you might have a line like:

if lcase(child.nodeName) = “title” then response.write (child.text)end if
Next

The above code loops through the items in the array and does something with each piece of data. This is where you display the information on your screen.

I cannot take credit for writing the above code. I found it online somewhere a long time ago and have used it on many web sites. It works great. If you don’t understand this, any decent web developer should be able to implement something like this for you.

admin: