Do It On The Server: The Right Way to Add RSS Feeds To Your Site Or Blog

Over the weekend I had a question from a reader asking me how to include an RSS feed into the content of his site. There are essentially two ways to do this: the wrong way (JavaScript) and the right way (PHP). Let me explain.

Why Use RSS Feeds?

First, though, let's talk about why you want to do this. To understand why, you have to understand what an RSS feed is. “RSS” stands for “Real Simple Syndication” and it's a way for publishers of content to provide content in a well-structured form easily manipulated by computer applications. That's what syndication is all about — making your content available for others to redistribute. The term is not new, of course, and has long been used in newspaper publishing. Most of the comic strips you see in a newspaper are syndicated, as are columns like Dear Abby and Dave Barry.

Technically, the term RSS itself refers to a specific syndication format. Another popular format is called “Atom”. In general usage, though, people tend to say “RSS” when they really many “any widely-supported content syndication format”.

All the major syndication formats are based on a text formatting standard called XML. XML documents are human-readable — mostly — but are easy for computers to process. The RSS feed for this blog starts out like this:

<?xml version="1.0"?>
<rss version="0.92">
    <channel>
        <title>Make Easy Money with Google and AdSense</title>
        <link>http://www.memwg.com/blog/adsense/</link>
        <item>
            <title>Another AdWords180 Recommendation</title>
            <link>http://www.memwg.com/blog/adsense/Another-AdWords180-Recommendation.html</link>
        <description>This is where the content would normally be.</description>
        <pubDate>Sun, 15 Apr 2007 13:25:07 -0600</pubDate>
    </item>

    etc., etc., etc.

RSS looks a lot like HTML in some ways, and that's because both HTML and XML are both “markup” languages. Unlike HTML, though, RSS feeds precisely describe the important attributes of content — when it was published, its title, its link, when it was last updated, who wrote it, an excerpt, etc. Its regularity and conciseness when compared to individual pages on a site/blog is what makes it so useful for various purposes.

RSS Feeds and AdSense

AdSense publishers in particular can find RSS feeds useful because they're a great source of keyword-targeted content.

For example, you can transform a Google Blogsearch query into an RSS feed. Here's the RSS feed for the phrase “keyword elite”, with the term in quotes:

http://www.google.com/blogsearch_feeds?hl=en&scoring=d&q=%22keyword+elite%22&ie=utf-8&num=10&output=rss

All you have to do to get this URL is do a Google Blogsearch for “keyword elite” and then click on the “RSS” link to the left of the results. Any software that understands RSS can take that link and use it to grab the latest blog entries about “keyword elite”. And there are lots of content sources available. Blogs are an obvious content source — most blogs publish at least a partial feed of their content — but so do article directories like EzineArticles (their complete list of article feeds is huge).

Yes, all kinds of tasty, keyword-rich content is available for the AdSense crawler to analyze and serve up super-targeted ads…. if you do it right!

Do It On The Server!

There are two popular ways to include RSS feeds on an HTML page. One way is to include a snippet of JavaScript on the page, the other is to use a PHP script running on the server. Both look mostly identical to the visitors viewing the page, but not to the crawlers!

The problem with JavaScript, you see, is that the crawlers never see the data from the RSS feed. That's because JavaScript runs in the browser, not on the web server. Crawlers aren't full-fledged browsers and they don't run the JavaScript code (at least not yet — it may happen at some point, though) they find embedded in an HTML page.

If you want the RSS data to be seen by the web crawlers, including of course the AdSense Mediabot, you have to process the RSS feeds on the server and insert the data right into the HTML page before it's sent out by the web server. This normally means doing it in a server-side scripting language like PHP. If you do it this way, both the crawlers and the human visitors will see the same data and they won't even know it came from an RSS feed after it's converted into HTML. You can see an example of this by going to my Squidoo lens about Keyword Elite and looking at the last section titled “Keyword Elite News” — that's actually an RSS feed that's been imported into the lens. But if you look at the underlying HTML you won't see anything special — the processing is all done on Squidoo's servers.

How To Add RSS Feeds To Your Pages

If you're comfortable with PHP programming, you can use the Magpie RSS and Last RSS code libraries to insert RSS content into your pages.

If you use WordPress, the feedList plugin does the job nicely.

If you're not a techie and you're not using WordPress, there's a commercial product called RSS Content Builder that will do the trick.

There are other solutions available, too, a quick search will find you many different options.

Hope you've found this helpful. Keep those questions coming!

Sponsored Link: Learn more about the ins and outs of
AdSense by reading Uncommon AdSense, my latest book about AdSense.

Eric Giguere is the author of Uncommon AdSense and the award-nominated (that just means it lost!) blog Make Easy Money with Google and AdSense.

Socialize This Post (Please!)

Add to OnlywireAdd to Onlywire

Tags

Comments

Comments are closed.

Subscribe without commenting