Opinions of Peter Belmont
Speaking Truth to Power
 
.
.
 

How to Create An RSS Feed for Your Own Web-Site

by Peter A. Belmont / 2016-04-03
© 2016 Peter Belmont


RSS

Recent Essays (All Topics)
 
•(12/23) How did we get to October 7th?
•(11/23) Our Political Habits Are Ending The Human Race
•(10/23) Sketch of Israel-Palestine History
•(10/23) Whoever controls the discourse controls emotional reactions to reality
•(08/23) Russia On Trial
•(01/23) The Purpose of "Conservatism"
•(10/22) The project of returning the earth to the cockroaches couldn't be in better hands!
•(05/22) Abortion, The Constitution, And The Supreme Court
•(03/22) The Problem of Climate Change Framing or Discourse or Understanding
•(06/21) Israel-Palestine: If not apartheid, then what?
I am a programmer, and this essay is a description of how I create(d) an RSS Feed for my own blog (123pab.com). It is, I suppose, principally a guide for programmers. Non-programmers presumably establish their web-sites as clients of services (“platforms”) such as Blogger, Tumblr, and WordPress.

Those interested in the history of RSS Feeds may find this interesting.

I code my web-pages in PHP. All my experience of RSS-Feeds has been with the FireFox browser running under Ubuntu (Linux). Other browsers may work differently.

     Table of Contents
     •How RSS Feeds Work
     •Code For RSS-Icon
     •Code for XML File
     •XML Example

First I describe how RSS Feeds work. Several things need names here. One is ”the web-site” for which an RSS capability is to be established. Another is ”the browser” belonging to someone (”the visitor” or ”the user”) who visits the web-site, accesses its RSS-Feed capability, and later uses the link-list. The last item is the ”link-list”, a sort of mini-table-of-contents to materials associated with the web-site.

What Is An RSS Feed?

An RSS Feed is a mechanism by which the manager of the web-site creates
      [1] a frequently updated list of labeled links, similar to the list of links called “Recent Essays” on this page, top right. These links are each like the usual HTML links. In this essay, I call this list a ”link-list”. The “link-list” items point to web-pages relating to the web-site, often a list of recently added elements (such as photos or blog-postings);—which mechanism is
      [2] made available to a visitor to that web-site by allowing the visitor to establish—as a “bookmark” in the visitor’s own browser—a way to view the link-list automatically without explicitly visiting either the link-list itself or the web-site. The user may establish that bookmark by clicking on a link (”the RSS-link”) at the web-site usually signified by name (RSS) or by an RSS-Icon such as:


How A Visitor Uses An RSS-Feed

When the visitor visits the web-site which presents an RSS-link, that visitor may left-click the RSS-link and thereby cause a dialog-box to appear. The business of this dialog-box is to permit the visitor to create in the visitor’s own browser a “bookmark” which links to the “link-list” for the web-site. The dialog-box asks the visitor what to call this new bookmark and where to put the new bookmark among the bookmarks already managed by the browser.

When the visitor supplies the requested information and clicks the “subscribe” button, a bookmark of the specified name automatically appears in the designated place among the visitor’s browser’s bookmarks.

When, later, the visitor allows the mouse-arrow to “hover” over the bookmark for the RSS Feed, a drop-down menu will appear which shows the then-curent “link-list” and the visitor may click on any link of this drop-down menu to jump to the designated web-page.

How It Works

The bookmark is essentially a link to a web-page which, when visited, produces (not HTML material as most web-pages do when invoked/visited but) an XML file (more on that below) which provides the contents of the link-list and “looks” like an RSS XML file.

The browser knows which of the user’s bookmarks are RSS-Feed bookmarks. When the browser is opened, it visits the link-lists associated with the several RSS-Feed bookmarks, reads those lists, and saves them. Thereafter, the browser “refreshes” these (saved) link-lists on its own refresh-schedule or upon explicit demand by the user.

When the user “hovers” over an RSS bookmark, the browser recovers its link-list and displays it. All of this happens without the user having to visit the web-site explicitly: the user may read the items descriptions on the link-list and decide which web-pages, if any, to visit (by left-clicking on a link).

How The RSS Table Of Contents May Change

The manager of the website must create a web-page written in a special language, XML, which has within it the data for a link-list: that is, it contains a list of {description, URL} pairs from which the visitor’s browser will create the drop-down menu for the “link-list”.

This XML program may be changed at the whim of the manager of the web-site. Typically, this program (and the link-list it creates) is changed frequently—every time a new item of interest is to be added to the link-list.


How To Code The RSS-Feed Icon

The programmer for “the web-site” chooses a particular RSS-Icon from those available (gratis) on the internet, for instance:
http://www.newsniche.com/rss.gif
and also creates a web-page whose business is to produce the XML “link-list”, for example
http://123pab.com/blogfeed.php
The clickable link to the RSS facility—which sets up the bookmark in the visitor’s browser—is then the usual link:
<a href=”http://123pab.com/blogfeed.php”><img src=”http://www.newsniche.com/rss.gif” width=”20” height=”20”></a>
That’s the easy part.

Code for the XML File

The hard part—involving a bit of programming as a rule—is producing the XML file. I suppose it could be written “by hand” and uploaded (also “by hand”) to the web-site’s server, something like:

blogfeed.xml:
XML-file contents-written-out-by-hand
or blogfeed.php:
<?php
print <<<HERE
XML-file contents-written-out-by-hand
HERE;
?>
What I did was different: I wrote a PHP program, blogfeed.php, to create my XML materials. When anyone (or anyone’s browser) visits my blogfeed.php, the PHP program runs on the server where my blog resides. When it runs, it interrogates my database to find the most recent blog entries and creates the XML text (including a link-list of those most-recent blog entries) and returns that XML text. (Most web-pages, when visited, return HTML text which browsers interpret to make visible web-page screens. The XML, in this case, is interpreted to make a link-list.)

In either case, your text XML file, rssfeed.xml, (or, alternatively, your PHP program which returns an XML output, rssfeed.php) should produce a text like the following. Note that the example following—which works under Firefox and (I hope) works on other browsers—is a bit “tainted” by a rival and much more complicated coding standard, called “atom”. Readers with a desirte to get further into the differences between “atom” and “rss” might start their research here.

What follows is very simple and “works for me”.
<?xml version=”1.0”?>
<rss version=”2.0”>
<channel>
<title>Your Title</title>
<link>http://yourdomain.com</link>
<description>your domain’s description</description>

      and now a list of “items”, each of the following form:

<item>
<title>title of link-list-item</title>
<link>URL of link-list-item</link>
<description>Descriptive paragraph for your link-list-item</description>
</item>

     and after the list of “items”, finish like this:

</channel>
</rss>












Comments:

Submit a comment, subject to review:

    Screen Name (Required)
    Commenter's Email (Required)
    Commenter's Blog (Optional)
     

      uvdadkvmjk
      1234567890

From the preceding TOP string, select as the Verification Code,
thi2rd through si3xth letters
(using the BOTTOM string for reference) and enter it in the slot below
    Verification Code (Required)
  Comment
 
 


123pab.com | Top
©2014, 2015, 2016, 2017, 2018, 2019, 2020 www.123pab.com