At the Forge

COREBlog

Reuven M. Lerner

Issue #120, April 2004

It's not a Web development framework without a blog package. Here's a Zope-based system for a Web journal with all the bells and whistles.

Over the past year or so, this column has looked at a number of open-source products that can serve as a content management system (CMS) for a Web site. If you publish a newspaper, magazine or Web site with content that changes on a regular basis, such a CMS undoubtedly could be a boon to your site. After all, why should you modify the links, headlines and other items by hand, if software can take care of those tasks for you?

A traditional CMS is a big, complex piece of software, because it needs to take into account the many different types of organizations of Web sites. Should anyone on your staff be able to create new articles or only reporters? Which editors should be allowed to post items to the Web? What sorts of headers and footers do you need? What sort of search mechanism do you need? The answers are almost endless, which explains why CMS software can be complex to install and administer.

If you want to publish articles on a regular basis but don't want the administrative overhead associated with a full-fledged CMS, you might want to consider a Weblog. Weblogs, also known by the shortened name blogs, began in the mid-1990s as personal journals, on-line diaries that allow an individual to write and post articles quickly and easily. And although blogs vary considerably in style, their format tends to be fairly uniform, which reduces the complexity of the software, making it easier to configure and administer.

This month, we take an initial look at open-source Weblog software, as well as the standards that have become increasingly prevalent in the blogging community. Along the way, we look at COREBlog, a Zope-based tool that makes it fairly easy to create and administer a Weblog.

To be honest, I have some personal interest in finding a good blogging package. Having read a number of Weblogs over the last few years, I've decided it's time to try blogging for myself. The results of my search should be available by the time you read this at blog.lerner.co.il (Figure 1).

Figure 1. The author's blog uses the Zope-based COREBlog package.

What Is a Weblog?

Weblogs come in all shapes and sizes, reflecting their authors' interests and styles. That said, a number of characteristics are common to most Weblogs:

  • Order: postings are displayed in reverse-chronological order, with the most recent article displayed at the top of the page. The Weblog's home page typically shows only the last few days of postings, with the rest available through an archive feature.

  • Comments: readers of the Weblog are invited to submit comments, often posted immediately following the article in question. In this way, Weblogs are similar to Web-based forums, except only the blogger is allowed to begin a discussion topic.

  • One author: typically, only one person participates in a Weblog. Some Weblogs are written by multiple authors, but this is relatively rare. A Weblog's comments, as described above, are written by people other than the main author.

  • Syndication: the contents of a Weblog generally are made available using an XML format known as RSS, which stands for really simple syndication. This makes it possible to retrieve, analyze and collect a number of different Weblogs, creating something akin to a personal newspaper.

  • Trackback: introduced by the proprietary package Movable Type, trackbacks make it possible for Weblogs to keep track of links pointing to one another.

  • Web-based editing: because Weblogs exist only on the Web, their interfaces expect that you want to write and edit postings using your Web browser. Administering a Weblog in this way makes a great deal of sense, but writing and editing in a Web browser can be an unpleasant experience. Many Weblog packages offer desktop applications that ease this pain, allowing users to write using a word processor or simple text editor and upload the final product when they are done. Open-source systems are available that can make such off-line editing possible, but they involve some configuration. Therefore, you probably are going to need to get used to writing inside of a text-area widget or learn how to customize Mozilla so you can use a friendlier editor. You also can look into the open-source Epoz Project, epoz.sf.net, which provides a cross-browser, JavaScript-based editing system.

The above list is not comprehensive. Plenty of Weblogs lack comments, syndication or trackback. But just as English-language newspapers evolved to have a common set of style rules for headlines, captions and story ranking, so too have Weblogs evolved to have a common set of expectations. And the competition for features is rather fierce: when one Weblog package adds a useful new feature, others usually implement it within a short period of time.

The above features would be easy and straightforward for an experienced Web/database programmer to implement in a high-level language, such as Perl or Python. If you use a relational database, say PostgreSQL, to store the articles, you no longer have to worry about ordering or file storage, so you can concentrate on output. And indeed, some prominent bloggers, such as Tim Bray, author of the excellent Ongoing Weblog at www.tbray.org/ongoing, have created their own Weblog software.

As much as I enjoy writing new programs, I dislike reinventing the wheel. And given the plethora of good, existing solutions for creating a Weblog, including several that allow me to write plugins that extend their functionality, I decided to use something that already exists, extending and modifying it as necessary using an established API.

Moreover, some of the nicer Weblog features, such as comments and trackback, can be tricky to implement. They aren't necessarily hard to work with, per se, but given that it seems 100,000 different mechanisms for commenting on Weblog postings already are out there, I would like to avoid creating number 100,001.

I should note that if you are interested in creating your own Weblog, there is an alternative that allows you to avoid writing or configuring any software at all—namely, using one of the many free Weblog hosting sites on the Internet. These might be a perfectly adequate solution for most people, but I still would like to have some control over the software that I use. Moreover, I would like to integrate my Weblog into the rest of my site and domain, meaning that I need to install it on my own system.

COREBlog

If you are looking for the open-source Weblog package with the simplest installation, and if you already are familiar with the Zope application server, you might want to consider COREBlog. COREBlog, written by Atsushi Shibata, is an actively developed Zope product, or plugin module.

Zope, as I have mentioned in previous installments of this column, is an open-source application server written and distributed by Zope Corporation. Zope is written largely in Python and is object-oriented, using an object database (ZODB) to store most of its core information. Zope development is quite different from other languages and application servers, and adjusting to its mindset can take some time and effort. But it also is quite flexible, making it easy for developers to add their own modules (products) to the system.

COREBlog comes as a standard tarball, which must be opened in the lib/python/Products directory under your Zope root directory. As of this writing, the latest version of COREBlog is 0.53b, which arrives on your system as a file named COREBlog053b.tgz system when you download it from www.coreblog.org. The following instructions assume that the environment variable ZOPE is set to Zope's root installation directory (/usr/local/zope on my system) and that the tarfile for COREBlog is in /tmp:

# cd $ZOPE/lib/python/Products
# tar zxvf /tmp/COREBlog053b.tgz
# chown -R zope.zope # Or appropriate owner/group

Restart Zope, either manually or from the Web interface in its control panel, and COREBlog automatically is added as an available product.

To use COREBlog, you need to create an instance of the product from the Add menu in the upper-right corner of the screen. Point your Web browser to the /manage URL on your site (for example, www.example.com/manage), and select COREBlog. You are asked to provide an ID (a unique name to appear in the URL), as well as a title (which appears as the name of the Weblog) and a character encoding (which defaults to ASCII and which I normally change to UTF-8, for full Unicode support).

At this point, the Weblog is almost ready to be unveiled to the world. We can view the Weblog using a URL that ends with the ID we assigned to it (for example, /atf), or we can administer it by appending the /manage path to that name (in our case, /atf/manage).

Because every posting in COREBlog must be associated with at least one category, we must create at least one category before we can begin to post. Indeed, a warning in red tells us we must add a category before continuing. A Categories tab resides on our blog management screen; click on it, and you are invited to add a new category. We also can rename categories and see how many postings are associated with each category.

Once we have created a category, we can click on the Entries tab and begin to enter new postings. Each entry consists of a minimum of a title, body and category. Other items are either optional or defaults to reasonable values, such as the current date and time. When you have finished posting an item to the blog, you can preview it (which I highly recommend) with the Preview button or publish it right away with the Add button. Once you have published the story, it is visible to the entire world. Anyone reading your Weblog can see the new posting at the top of the page.

But someone doesn't have to look at the top of the page in order to notice the new posting. The recent entries area of the sidebar contains links to each of the most recent postings. The calendar has a hyperlink to all of the postings made on a particular day. And clicking on the topic displays all entries on that topic. This works only for topics, though, not for subtopics.

Customization

The easiest way to customize COREBlog is to use the Web-based properties editing tool, labeled Settings. The Settings tab allows you to write and edit the content and behavior of the various pages on the site. For example, you can write a bit about yourself or your Weblog or indicate that comments are to be moderated by default. If you are interested in changing the fonts and colors in which your blog is displayed, click on the Skins tab to gain access to such information.

You can customize COREBlog further by modifying the DTML pages used to display output. In particular, you can change the sidebar (along the right side of the page) by modifying files in COREBlog/dtml/modules (under $ZOPE/lib/python/Products). These pages are written in DTML, Zope's original server-side templating language. The file index_html.dtml does nothing more than invoke and use each of the other files in the directory:


<dtml-var calendar>
<dtml-var about>
<dtml-var recent_entries>
<dtml-var recent_comments>
<dtml-var recent_trackbacks>
<dtml-var categories>
<dtml-var archives>


In order to change the order of modules or which modules appear at all, simply modify index_html.dtml. You also can create your own modules, write new DTML files and use the COREBlog API to retrieve information about what has been said and done on the blog.

Of course, because COREBlog is an open-source product, you can view and modify any part of it you like. To be honest, there isn't much to modify; most of the features in COREBlog probably are ones that you want to include in your Weblog. Given that the project is under active development, new features should be added soon.

Syndication

When you become an established blogging pundit, people will turn to your site several times a day, looking for your latest wisdom and pointers to interesting links. People who follow more than one blog or who want to integrate Weblogs with some news sources use an aggregator program to collect content from various sites. Aggregators do not look at the HTML directly; rather, they retrieve the syndication feed as distributed in RSS.

COREBlog makes it easy to syndicate your site. Indeed, you don't need to do anything in order to syndicate postings on your Weblog. COREBlog takes care of this for you automatically, providing both the popular RDF and RSS formats. There is nothing to configure in order for syndication to work; COREBlog comes with working syndication out of the box.

Conclusion

Content management systems are wonderful for organizations that need them. But if you are running a Web site by yourself, a full-fledged CMS probably is overkill. Many individuals have begun to publish Weblogs in the last few years, and although Weblog software still is in a relatively early stage, such products do make it easy for an individual to get started publishing articles on a regular basis, in an easy-to-understand, standard format. COREBlog is one open-source application for creating and managing Weblogs, and it seems to do an excellent job of offering the basics. It also provides a plugin architecture so new modules can be added to the system without having to restart it from scratch. Next time, we continue on our tour of open-source Weblog software, comparing some other packages to COREBlog.

Reuven M. Lerner, a long-time consultant in Web/database programming, is now a graduate student in Learning Sciences at Northwestern University in Evanston, Illinois. You can reach him at reuven@lerner.co.il.