How to Display RSS Feeds with Ajax javascript

A lot of webmasters are confounded with the pros and cons in employing JavaScript to exhibit their RSS feeds. JavaScript can be conveniently utilized to display RSS feeds on an internet site, not only make amazing wordpress themes. However, some say it is not the most search engine-friendly technique available.

PHP coupled up with HTML is the favored method for showing RSS feeds on a website when it comes to search engine optimization. This is so as servers use the PHP language to communicate with an HTML website. The search engine doesn’t recognize the PHP, but it acknowledges the HTML that PHP initiates and controls via the server.

Search engines are very old fashioned in relation to picking out new mark-up language technology. You could say search engines are dawdling so far in arrears in terms of mark-up language interpretation, that it’s surprising that they still manage to keep functioning. They continue to work because HTML is still the main language applied by websites.

On the other hand, search engines have made great strides in recognizing other shades of exploring on the internet, such as recognizing when illegal linking schemes are present on websites. So, they are not old hat in certain linguistic context, but they definitely are in the Modern language recognition department. This lands us back to our discourse about JavaScript and RSS feeds.

JavaScript is a web mark-up language that’s acknowledged and read by the user’s web browser, but not all the time, dependent on the rig of the site. JavaScript’s can also be operated by the host server in showing RSS feeds upon a website. In either case, they are still not recognized by search engines-search engines can’t read JavaScript’s.

Consequently, the only benefit a site has, that is displaying RSS feeds via JavaScript’s catch is user interactivity statistics. These are a component part of search engine analytics. If search engines, recognize that a specific website displaying RSS feeds via JavaScript is being visited frequented and those visitors are hanging around for long periods of time, then it will give credits to that site by grading it higher than it typically would have without the interactivity.
It’s a great deal more difficult to apply RSS feeds technology using PHP than it is JavaScript, but they are worth the endeavour. Webmasters would have had to learn the PHP mark-up language, which isn’t easy; whereas before they would be capable to use it to display RSS feeds. There are several RSS feed reader software package on the marketplace and there are also many sites that offer free versions.

The PHP to HTML option of exhibiting RSS feeds is much more search engine friendly. When the server communicates to the website, it uses the PHP language to do the intercommunicating. The website then replies to the signals from the server by using the HTML mark-up language, which is what the search engine sees’s and can recognize.

The RSS feed is then displayed amongst the HTML codes and tags; where the search engine crawlers pick them up and deliver them to the search engine directory
for filing away. So when search terms fitting those key words are entered into the search bar, the search engine shows the archived data to the human searcher.

The search engine therefore comprehends the RSS content between the HTML codes on an internet site displaying RSS feeds as belonging to that particular website. So although the RSS content or feed is being fed in from a different site, the search engine believes that it originates from the website displaying the RSS feed. This is the reward of using PHP and HTML to display RSS feeds on a website.

In closing, using JavaScript for displaying RSS feeds does produce some good, but it decidedly has its share of drawbacks. Using PHP and HTML to display RSS feeds on the other hand, is plainly the better option; all the same, it is the most difficult.

While exhibiting an RSS feed on your site, it will supply you with some content and hence some stickiness. Nevertheless, there are some downsides. You will be depending on the service you’ve chosen, there will be downtime and the internet site may vanish altogether. You will not receive Search engine benefits as they can’t yet utilise the JavaScript.

If you prefer a more flexible and beneficial choice, then you should use PHP to parse and display your RSS feed. You’ll need some PHP knowledge for this, but it’s worth the effort involved.

SimplePie provides a free PHP class that performs most of the arduous work for you – making it comparatively easy to use your own online server to display RSS feeds. There are other more established options such as Magpie and Carp but SimplePie offers effective documentation and clear-cut instructions.

Find a service that has done this hard work, here are sites that offer RSS to Javascript processing.

Using Google API for Displaing Feeds with AJAX.

Step 1: With a free Google API key you can set up the feed with Ajax almost in a few minutes, just head to their signup page, enter your site’s domain and the key is generated instantly, will work only with that domain.

Step 2: The code below should go to the  <HEAD> section of your webpage, which calls the  Google Code API key and you must not skip this step.

<head> <script type=”text/javascript” src=”http://www.google.com/jsapi?key=YOUR-API-KEY“> </script> <script type=”text/javascript”> google.load(“feeds”, “1”) //Load Google Ajax Feed API (version 1) </script> </head>

Step 3: Once you called the Google Ajax Feed API on your page, all you need to do is use the JavaScript to load the desired RSS feed(s), then retrieve /display the feeds in the manner that suits you best. For example:

<div id=”feeddiv”></div> <script type=”text/javascript”> var feedcontainer=document.

getElementById(“feeddiv”) var feedurl=”http://rss.slashdot.org/Slashdot/slashdot” var feedlimit=5 var rssoutput=”<b>Latest Slashdot News:</b><br /><ul>” function rssfeedsetup(){ var feedpointer=new google.feeds.Feed(feedurl) //Google Feed API method feedpointer.setNumEntries(

feedlimit) //Google Feed API method feedpointer.load(displayfeed) //Google Feed API method } function displayfeed(result){ if (!result.error){ var thefeeds=result.feed.entries for (var i=0; i<thefeeds.length; i++) rssoutput+=”<li><a href='” + thefeeds[i].link + “‘>” + thefeeds[i].title + “</a></li>” rssoutput+=”</ul>” feedcontainer.innerHTML=

rssoutput } else alert(“Error fetching feeds!”) } window.onload=function(){ rssfeedsetup() } </script>

Lorelei

Lorelei is a co-founder of PSwish.com and Lorelei Web Design has over 15 years of experiences in Wordpress, web development, Photoshop & design. Fueled by coffee, chocolate, peanut butter and Irish cream.

You may also like...