Fog Creek Software
Fog Creek Software

CityDesk 2.0-Documentation
Using Keywords Effectively

Keywords allow you to do a couple of interesting things:

  1. You can assign keywords to each article to make them easier to find.
  2. You can use keywords to create custom tables-of-contents that list articles containing a specific keyword.

Theoretically, the keyword field is completely free form. You can type anything you want. But there are a couple of things you should be aware of.

First, remember that keyword matching is rather simplistic, both in the Search Dialog and when you use the keywordContains condition in a forEach loop. For example, searching for the keyword pain will also find Spain; searching for cook will find cookie, and so on.

The easiest way to avoid this is to put keywords inside parentheses. For example:

(pain) (cook)

Now you can search for (pain) or (cook) without articles about Spanish cookies showing up.

Suppose you are managing a business web site with CityDesk. You would like to include the ticker symbols of all public companies mentioned in each article in the keywords field. But the ticker symbol of AT&T is T, and if you just searched for keyword T, you'd find a zillion other things, too.

If you adopt the convention that you will use the keyword TICKER(x) for ticker symbols, then when you have an article about AT&T and Microsoft, the keywords will be:

TICKER(T) TICKER(MSFT)

This allows you to have other keywords with completely different meaning.

Once you've got these set up, it's easy to generate an index page which lists all articles about, say, Microsoft:

<h1>Articles About Microsoft:</h1>
{$ forEach x in (keywordContains "TICKER(MSFT)") $}
<a href="{$x.link$}">{$x.headline$}</a><br>
{$ next $}

In fact, this is a general technique you can use to create any kind of custom index of your site. Want to create a list of "Editors' Favorite Stories of 2002"? Add the keyword FAVE(2002) to each story and create an index using the same technique.

Cool, huh?

 

CityDesk Documentation -  Home


©Copyright 2001-2003 Fog Creek Software, Inc. All Rights Reserved.