How to make a Feed ?
How to make a Feed ?
Making a feed for your website is a necessity today. Adding a feed to your website will enable your subscribed users to keep themselves updated with the latest content of your website. Feed readers will allow the subscribed Users to read the entire content or summary of content at one place for various websites. Adding a feed to website also helps in Search Engines finding your Content faster by the feed aggregators.
Feeds are XML format data with latest contents of website. Feed come in various versions. RSS and Atom feeds are the most popular feeds offered by various websites today. Atom Feeds are considered more advanced than RSS feed and hence we will try to add an atom feed to our website. So lets see how you can make a feed and add it to your website ?
The advantage of adding feed to your website will be satisfied and informed users. Users subscribe to your feed so that they can always check latest content through a feed reader without coming back to your website (in case of full text feed). The users are free to unsubscribe whenever they want to. Thus feeds give them complete independence of following or unfollowing your content, compare it with e-mail subscription where the process is not transparent (read trustworthy). If your feed only gives a summary of the content the users can always check back at your website, however its annoying and full text feed are always welcomed by your User.
A great tutorial of Creating an Atom Feed in PHP can be found at
Additionally for details of various Atom feed tags, you can refer
I created the atom feed for www.jahajee.com referring to above two webpages in 3 hours.
I am also using additional tags like <icon></icon> and <logo></logo> in the feed section.
If you have a permanent domain name for your website then use that for the <id> tag as certain browser like Firefox gives an option to open the "title". If your Domain name is the id then clicking on that will open your website else it opens a blank page.
The Complete Atom preamble for my website looks like
<?xml version="1.0" encoding="iso-8859-1"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
<subtitle>Recent Topics on JAHAJEE</subtitle>
<link href="https://www.jahajee.com/syndication.php" rel="self"/>
<updated><?php echo date3339();?></updated>
For the topic feeds I am using the PHP Code almost as given in the tutorial. Once everything is set and your atom feed is validated by the Feedvalidator, you can add the below meta tags within the <head></head> tags of all pages of your website.
<link rel="alternate" type="application/rss xml" title="WEBSITE NAME" href="/syndication.php">Adding this in your meta tag will allow the browser to highlight the "Subscribe to this Page.." indicating the Users that your website offers Feeds for subscription (Live Bookmarks for Firefox).
Now the browser knows that you offer atom feeds for your website but still the users do not know where to find them. So you need to add the link for subscribing your website feed. You can use either text link or image link with the feed address whichever suits you, just remember that the image needs to be that of typical feed icon for easier understanding by your user.
Also remember that following the Feed links (URL) result differently in different browsers. While Internet Explorer and Google Chrome opens and displays the complete feed, Firefox opens a confirmation box asking you to "Subscribe with Live Bookmark". I found the Internet Explorer Page source resulted exactly what your Syndication.php would produce and for checking what is offered as feeds you can use IE Page source.
Please do not try to follow my syndication link for subscribing as I redirected it to my feedburner feed later. For details please read Redirect Users from original atom feed to feedburner
Full text feed will give the complete content of your topic in contrast to summary of the content. Full text feed subscriber will not come to your website for reading the content, thus for a website owner it means less traffic. Most non-ecommerce website revenue depends upon advertisement which is affected by the number of visitors to website. So a website may even loose revenues with full text website ! Also with full text feed your content can be easily copied.
If full text feed have so many problems then why do famous bloggers still prefer Full text feed over Summary feed ? Answer is simple, because its good for Users and publishers (website owners). If your user has subscribed to your Feed this means that he is interested in your website and is willing to be your loyal reader. Trust me, its annoying to move from feed reader to your website just to find the content was not interesting. Moreover if a user likes your website content then there are other ways like comments, replies, pictures etc. to bring him back then just your content. As for the revenues issue, even the atom feeds can have their own advertisement thanks to feedbuner by Google.
The content needs to be escaped to show the entire content of the topic and we will use the <content> tag and not the <summary> tag. nl2br() is a PHP function which will convert a new line to <br/>. htmlspecialchars() is a PHP function to convert HTML tags to special character recognised by your browser and to avoid any feed error while generating the full text feed. The content tag will have the type declaration as html.
The PHP code would be modified to
// Since we will not be using the summary, so either delete or mark it as comment
// echo "<summary>".row['subtitle']."</summary>";
echo "<content type='html'>".htmlspecialchars(nl2br($row['content']))."</content>";
Well thats it, hope that switching to full text feed results in more happy subscribers for your website. ;-)
PHP TUTORIAL WEBSITE BASICS