Web DevCenter    
 Published on Web DevCenter (http://www.oreillynet.com/javascript/)
 See this if you're having trouble printing code examples


Understanding Weblogs

by Wei-Meng Lee
12/30/2002

One of my favorite stops when browsing O'Reilly Network is the list of weblogs running down the right side of the home page. Explained simply, weblogs, or blogs, are informal writings, discussing something of interest or simply trying to make a point. O'Reilly weblogs tend to be technology-focused. But other weblog sites, such as Boing Boing, or Brian Jepson's Radio Weblog, cover a wide array of topics.

On the surface, weblogs appear no different than conventional Web articles, but one salient feature of these posts is that they depend on specific lines of XML that are usually referred to as an RSS document (Really Simple Syndication or Rich Site Summary). The use of this RSS document allows other webloggers to exchange content as well as integrate information into their own postings. An interesting history of blogging can be found at www.rebeccablood.net/essays/weblog_history.html.

In this article, I'll show you how to build a simple weblog using Radio UserLand, then I'll spend some time explaining the fundamentals behind weblogging.

Essential Blogging

Related Reading

Essential Blogging
Selecting and Using Weblog Tools
By Cory Doctorow, Rael Dornfest, J. Scott Johnson, Shelley Powers, Benjamin Trott, Mena G. Trott

Publishing Your First Weblog with Radio UserLand

Let's build a very simple blog using Radio UserLand. The Radio UserLand is an easy-to-use weblog tool from UserLand that allows you to publish blogs, as well as subscribe to those written by others. You can download a 30-day trial of Radio UserLand at radio.userland.com.

First, install the just-downloaded version of Radio UserLand (version 8.08 at the time of this writing). If you are running a Web server on your machine, Radio UserLand may prompt you to enter a port number other than 80. In this case, enter 5335. Radio UserLand works like a Web server that runs on your machine, hence your interaction with Radio UserLand is all through a Web browser. All changes to your weblog will first be saved locally, and then uploaded to an Upstream Server.

Next, enter in the registration information to set up your weblog on radio.weblogs.com. UserLand provides a hosting service for its customers, who pay $39.95/year. For the 30-day trial, UserLand will host your weblog at no cost for the first 60 days. You can also upload to a Web server of your choice via FTP.

Figure 1. Registering for an account on Radio UserLand
Figure 1. Registering for an account on Radio UserLand

Once the registration is completed, you'll be given a user number. In my case, my user number is 116465. My weblog will thus be hosted at: radio.weblogs.com/0116465/

You can now start writing your weblog:

Figure 2. Adding an entry to my weblog
Figure 2. Adding an entry to my weblog

You can use the WYSIWYG option and treat the editor window just like a word processor (bold, italic, underline, change fonts, add Web link, etc.) or you can use the Source option to type in HTML codes. When you are done, click on the Post Changes button to save your posting.

Besides allowing you to create a weblog, Radio UserLand allows you to aggregate news from the Web (select News from the top menu).

Figure 3. Using the News Aggregator in Radio UserLand
Figure 3. Using the News Aggregator in Radio UserLand

You can either read the news or select the required news clip that you like and paste it into your weblog (by clicking on the Post link):

Figure 4. Editing a post from another source.
Figure 4. Editing a post from another source. This posting would be added to my weblog

Radio UserLand also allows you to add your own news subscription by clicking on the XML icon (with the coffee cup):

Figure 5. The two buttons on a Radio UserLand weblog
Figure 5. The two buttons on a Radio UserLand weblog

To add a subscription, you can enter an URL containing an RSS document (more on this later) or, for those weblogs created with Radio UserLand, you can click on the XML icon, as shown in Figure 5. Here I am subscribing to Brian Jepson's weblog:

Figure 6. Subscribing to other Weblogs
Figure 6. Subscribing to other weblogs

You can also change the theme of your weblog by clicking on the Themes item on the top menu. To view your newly-created weblog, click on the Home link, as shown in Figure 7:

Figure 7. Click on Home to view your weblog
Figure 7. Click on Home to view your weblog

So there you are! You have just created your first weblog in less than 15 minutes! Isn't it easy?

Figure 8. Viewing your newly created weblog
Figure 8. Viewing your newly-created weblog

The Gory Details

While you would frequently see the words weblog (or WebBlog) and RSS together, they don't mean exactly the same thing. RSS is a Web content syndication format. What this means, simply, is that you can use RSS to gather news on the Web. Although RSS is commonly used by webloggers, it has wide applications, especially among news agencies such as New York Times, as a mean to distribute their news content.

What Exactly is RSS?

RSS is an application of XML. A RSS document looks like this:

Click for larger view
Figure 9. An RSS document for my weblog (You can click on the image for a full-size view)

If you compare the XML document shown above with my weblog, it's not difficult to see that the RSS document actually contains the content of my blog. It's somewhat similar to the concept of Web services -- while my weblog provides a visually appealing representation of things I want to say, the RSS document contains the actual content of the Web site, without all of the fanciful graphics. This concept is very powerful.

Suppose today you have to visit several Web sites for the latest news. Now, imagine that all these Web sites provide RSS documents describing their content. So all you need to do is to aggregate the various RSS documents and read it in one place -- hence the phrase "News Aggregator." I won't delve into the detailed XML document structure here, but suffice it to say that there is a certain document structure that you need to follow.

A Two-minute History of RSS

RSS went through a number of revisions. There seems to be two camps: RSS 0.91, 0.92, 0.94, and 2.0 versus RSS 1.0.

As this is a religious topic that is fiercely debated, I will steer clear of the trouble here and instead point out some URLs that you can read. You decide for yourself.

Radio UserLand uses RSS 0.92.

Exposing Your Site as RSS

The next question that you may be asking is, "So how do I expose a RSS document on my Web site?"

Of course, the most straightforward answer is to use a blogging tool such as Radio UserLand, which generates the RSS document for you automatically. Besides Radio UserLand, there are a few good syndication and aggregation tools:

These tools automatically help you to create a RSS document describing the content of your site.

If you prefer to create the RSS document by hand, visit the following URL:

Once your RSS document is created, you can now make it available as a link on your Web site for other users to read from it. This process is known as syndication.

Validating Your RSS

Once the RSS document is generated, you'll want to ensure that it conforms to the relevant versionof RSS. If you create the RSS document by hand, then this is even more important for you to do. There are quite a number of RSS validators on the Web. Here are just two of them:

Aggregating RSS Documents

Technically, it's not difficult to gather all of the RSS documents from all of the Web sites exposing them and view the contents on your machine. This process is known as aggregation.

All you need to do is to download all of the RSS documents and send them to a XML parser. You can either write an XSLT (Extensible Stylesheet Language Transformation) stylesheet to transform the XML content into a format that you want (such as HTML for Web browsers or WML for WAP devices), or use DOM (Document Object Model) to retrieve all of the required elements. Unless you have a very good reason to do this (such as integrating the RSS content in your own application), why reinvent the wheel? There's a lot of software on the Net that helps you to repurpose RSS documents so you can view them in one window.

NewsZ Crawler is one such program. It allows you to browse normal Web pages as well as aggregate news from the Web. It also enables reading of NNTP news:

Figure 10. O'Reilly's Meerkat Open Wire Service
Figure 10. O'Reilly's Meerkat Open Wire Service

O'Reilly's Meerkat is also a news aggregator, albeit a Web-based one:

Figure 11. O'Reilly's Meerkat Open Wire Service
Figure 11. O'Reilly's Meerkat Open Wire Service

Even if you want to integrate the RSS content into your Web application, there are tools available to help you do the job. Here are just two of them:

Final Thoughts

Weblogging is a terrific medium for sharing personal observations, as well as formal news. If you have something to say, I encourage you to create your own blog. Otherwise, I hope you continue to enjoy the words of others via this increasingly popular publishing format.

References

Wei-Meng Lee (Microsoft MVP) http://weimenglee.blogspot.com is a technologist and founder of Developer Learning Solutions http://www.developerlearningsolutions.com, a technology company specializing in hands-on training on the latest Microsoft technologies.


Return to the Web Development DevCenter.

Copyright © 2009 O'Reilly Media, Inc.