Subcribe to my blog
Home » Blog » Tutorial / Web » Adding RSS FEED function to a website.
Adding RSS FEED function to a website.

rss-coding_1

This a tutorial on how to setup RSS Feed for an ordinary html website. If you are using a blog then this is not for you because every blog system will have their own build in RSS Feed .This tutorial need you to have a basic knowledge of markup language and usage of “File Transfer Protocol” because later you will need a ftp client to upload your files to your web server.

 

Things you need to have:

1. Notepad or any text editor.
2. FTP client software.

Step 1:

Start your text editor and type in this code

rss-code_11

Save the file as rss.xml (with xml is the file extension). Ok let’s review the code and some explaination of what does the code do. In this set of code you will see some tags. There are title, link, channel, pubdate and item tags. Let me explain what this tag means and how do you use it.

If you are familiar with what is RSS FEED , then you should know that you subcribe to a website by clicking the website’s RSS link and subcribe. Sometime when you visit a news portal like staronline.com ( Online version of English press in Malaysia named Star ) , you will see a lot or at least more than one RSS FEED link that you can subcribe. We named all the RSS FEED link in that website as a channel. So this shows that staronline.com have several channel of news and you can subcribe to the channel that you most interested seperately.

Anyhow for an ordinary website , we only need one channel and in this tutorial I will use one channel for a reference.

rss-cod_2

Ok, now add a title to your channel by typing a name, in the title  tag. and type your website’s address into the link tag. Remember, to type the words in between your opening tag and closing tag.

Step 2:

rss-cod_3

What does item tag do? Ok, in this case item tag represent your article or news. So if you have 3 latest news then you will have 3 set of item tag. Inside item tag there’s some other tag’s that represent the content of each item.

rss-code_4

For pubDate tag  you need to follow the following format.  Sun, 19 May 2002 15:21:36 GMT.

If you have more than one item, then repeat the step as mention above.Remember all your item tag need to be wrapped by channel tag.

If you put in two item in step two , your code will look like this,

rss-code_5

And the complete code will be like this,

rss-code_6

Step 3:

Now save this file.

Step 4:

Fire up your FTP client and upload this file to the root directory of your website. Next you need to download your website landing page which is normally named “index”. The file can be index.html , index.php or index.asp.

Step 5:

open the file that you have just downloaded with your text editor. You need to put in a line of code into the <head> tag. Type in the code as show below.

<link rel=”alternate” type=”application/rss+xml” title=”Type in your feed title here” href=”Type in the url of the rss.xml file here”>

rss.xml is the file that you uploaded earlier to your webserver. Remember the line of code above need to be wrapped by head tag. This means that the code need to be in between opening head tag and closing head tag of your html page.

Step 6:

Now you need to create a link somewhere in your webpage, so that your visitor will know that they can subcribe to your website by clicking that link. You can put a RSS icon if you want.

Step 7:

Save the file and upload the file back to your website and overwrite the old file.

Step 8:

Now all you have to do is to edit the RSS FEED file which is the rss.xml file, everytime when you update your website .You need to update the item tag properties accordingly.

Above are 8 simple steps to add a RSS FEED function to your normal website.This wraps up my tutorial and hope this will help in your future project.

Post a Comment

Your email is never shared. Required fields are marked *

* :
* :
:
: