Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

How to create lists of ‘related articles’?

I would like to show lists of related articles in a side box, generated as automatically as possible for each page. Conceptually I think of comparing keywords of the article in question against those of others and showing X articles with at least Y identical keywords, but how to realize that in practice? Perhaps there are other ways. Has anyone a technique? Thanks.

Paul Iliano
Sunday, March 16, 2003

The only reliable way I can think of is to write down some conceptual 'groups' of articles for your site. For example, you might have:
- photo editing
- photo printing
- taking photos
- camera equipment
- locations
- photo book reviews
- photo software reviews
- etc

You can then add a keyword to all articles related to each of these topics. Articles can have more than one topic.

Then I'd create a bunch of variables that contain CityScript to generate lists of all articles that contain each keyword.

So, if you write a new article that relates to equipment and locations, you could stick the {$.topicEquip$} and {$.topicLoc$} variables in the sidebar.

It's not really automatic, but it would work. It'd be a little bit of a hassle remembering to add keywords and sidebar content to each new article.

The other option is to put all related articles in the same folder, and pull them in using the folder name. You wouldn't be able to have the same article in multiple topics this way, though.

Let us know what you end up doing!

Darren Collins
Sunday, March 16, 2003

I think the folder way may be the best, but it does involve some work when you want to create a new category.

I end up coding in the sidebar as darren suggests. It's fun mixing your on links with external links.

www.marktaw.com
Sunday, March 16, 2003

Paul,

There are a couple of ways to do this, I think. Using keywords to filter is one way. I wanted to have a sidebar index of articles within the current folder. I created a folder-specific variable that searches the folder and excludes the index. For example, this one I titled SideSchool generates a list of the articles in the "school" folder, displaying filedates in reverse chronological order:

{$ foreach x in (and(folder "school") not (filename "Index")) SortDescendBy .fileddate $}{$setDateTimeFormat "English" "dd MMMM yyyy" "hh:mm"$}
<a href="{$x.link$}">{$x.filedDate$}</a>{$ next $}

I include the {$.SideSchool$} variable in the Sidebar field of all articles in the school folder. I use a modified version of this same variable in the index file itself to create an "annotated" index with teasers.

This works quite well. The only flexibility I'd like is the ability to exclude the current article from the index. I think this has been requested as an enhancement.

Scott McDonald
Monday, March 17, 2003

But he can't turn that over to someone else - a non techie - and expect them to replicate it and change the variables.

www.marktaw.com
Monday, March 17, 2003

It's really not too bad from a author training standpoint... One just has to know to add the appropriate variable to the sidebar field. But yes, the assumption is that any architectural work--e.g., adding a new folder, new index file, and new variable--is done by someone other than an author.

Scott McDonald
Monday, March 17, 2003

Can you make a variable a condition? I thought there were reasons CityScript couldn't do that.

www.marktaw.com
Monday, March 17, 2003

I would like to thank all of you for your suggestions, and apologize for being a bit late doing so.

I like Darren's solution using topic-specific variables most.

Putting articles in topic specific folders has the major inconvenience (at least for my needs) that an article can only belong to 1 folder and thus only to 1 topic. Since for my type of content articles can belong to multiple topics, I discard the folder option.

Paul Iliano
Wednesday, March 26, 2003

I wish there was a nice, easy, no scripting solution to this problem.  Right now, pretty much every article on www.valleyofthegeeks.com has a "Related Stories" side bar.  But I put those links by hand.  It's kind of a pain in the neck though.  I use the sidebar on the properties folder and I basically hard code the links to related or similar stories. 

Zack
Friday, April 04, 2003

*  Recent Topics

*  Fog Creek Home