Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Set Up a Simple Syndication Feed Using RSS : Page 4

You can set up outbound syndication for your Web site and expose your content to the world in one afternoon using an XML technology called RSS. For anyone who ever wanted to increase audience and traffic while maintaining content and presentation control, RSS is the answer. Find out how to do it, step by step.


advertisement
Finishing Touches
If you've done everything to this point, you now have a finished RSS file. You aren't quite done though. These last few clean up items accomplish some important tasks:
  • get the file to update periodically
  • ensure that the format is valid
  • ensue that the character encoding is appropriate for your feed
  • registering your feed so it can be found
  • categorizing your content

Update the File at a Scheduled Time
You could generate the file every time it is called, but ideally you want it to update periodically, like once a day. Depending on your platform, there are a variety methods to do this. With ColdFusion, one method is to create a ColdFusion Scheduled Task that calls the script that generates the RSS file. You can schedule it to run as often as your needs require.

Other methods might be using the cachedWithin attribute of the cfquery tag, creating a cron job (on a GNU/Linux system), using a Windows Scheduled Task, or setting a timestamp in the application and checking it each time the script is run.



Validate your RSS
There are many places on the Internet that will check the validity of an RSS feed. I like the one below because it gives you a detailed breakdown of any errors it finds:

http://feeds.archive.org/validator/check?url=<your RSS URL here>

All you do is go to the link with your RSS URL appended, like this:

http://feeds.archive.org/validator/check?url =http://services.devx.com:333/outgoing/devxfeed.xml

If your RSS feed is valid, you'll see this:

Otherwise you see a detailed breakdown of your feed, with lines numbers, errors, and a help link to explain what the error is and how to fix it.

Character Encoding
XML is, by default, encoded as Unicode. This can cause some problems if you have Windows character codes within the XML, such as the trademark character (). Characters like this can cause a lot of headaches, and there are two ways that I know of to get around the problem. The first is to put only valid Unicode characters into your XML. The other is to specify a character encoding-type at the top of your XML document. Setting the encoding type to a Windows-friendly character set can alleviate some problems.

To do this just replace the top-most tag in your XML

<?xml version="1.0" ?>

with this line:

<?xml version="1.0" encoding="windows-1252" ?>

There are many character encoding settings you can use. This article has a good explanation of character encoding.

Register Your Feed
In order for other sites to find and consume your content feed you have to list your feed with a feed aggregator, which maintains lists of categorized RSS feeds. There are many such sites on the Web. Some aggregators have up to 10,000 valid feeds already listed and this number is growing daily. Still, registering your feed with one or more of these sites is the best way to get the word out to the world that you are syndicating your content.

On Syndic8.com, to add a feed you simply create a login and then suggest a valid feed URL. After suggesting a feed, it gets submitted for review by a human. Once a human has approved it, it gets added to the valid feed master list.

It's a completely open and free process. When you sign up you will be asked to become one or all of the roles "Reviewer," "Evangelist," "Scraper," or "Fixer" to help out with the community.

Categorization
Categorizing your data feeds helps make it more useful to your syndication hosts. By categorizing, you can expose the subject matter of each piece of content. As the sheer volume of syndicated information on the Internet grows, it will become more and more important to provide this metadata, and it greatly increases the probability that other sites will link to you. You can add categorization in the <channel> tags and <item> tags, and each can have as many categories as you like. Here's an example of categories at the channel level and the item level:

<channel> <title>DevX Featured Content</title> <link>http://www.devx.com</link> <description>Latest DevX Content</description> <category>Technical Articles</category> <category>Computer Programming</category> <category>ColdFusion</category> <item> <title> </title> <description> </description> <link> </link> <category>Java</category> <category>software engineering</category> </item>

You can create your own categories or you can use public taxonomies, where other folks have created standard categories. A couple of examples of public taxonomy sites are http://dmoz.org/ and http://www.superopendirectory.com/. To use a public taxonomy you provide a link to the taxonomy in the <category> tag like this:

<category url="http://www.dmoz.org">Java</category>

Creating an RSS content feed is one of those projects that pays rich rewards for a very small upfront investment of time. For any Web site that wants to find painless ways to increase traffic while still controlling content, RSS is the right choice.



Ladd Angelius is a Software Engineer at DevX. He can be reached at ladd@devx.com.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap