Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Site map using foldernames

Howdy Folks,

I feel like I'm missing something obvious here....

I want to display a site map sorted in an outline fashion, but using the folder name and the title of each page as the link to the page rather than the actual absolute link. I'm thinking some sort of nested loop, but can't figure out how to get to the foldername.

For example:

I. Really Interesting Stuff
A. RIS Details
B. Still More RIS Details
    1. It can't be more interesting....

II. Really Boring Stuff....

Any thoughts about using CD to do this?


Jim Weisser
Saturday, February 15, 2003

You can't get to the folder name.

Your best bet is:

1. Create a site_map folder.

2. In that folder, create one article for each folder you want indexed. The headline should be the title of the section and the body article is a loop that brings in the titles (& teaser) of every article in that folder. If you have 5 folders, you'll have 5 articles.

3. In your root directory, create a "Site Map" article. This article will loop in the headline & body of all of site_map articles.

Minimally, it should look like this:

{$foreach x in (folder "site_map") $}



This "Site Map" article should be a passable sitemap of your site.
Sunday, February 16, 2003

The ability to script of the hierarchy is a sorely missed feature that really should have been in CityDesk all along.  Hopefully, the CityDesk folks will get it in for the next version, if there ever is a next version, if there are any CityDesk folks out there--they are so tight lipped it's really hard to tell.

David Burch
Sunday, February 16, 2003

Yes, but they're so public about being tight lipped that you really do believe *something* is going on.
Sunday, February 16, 2003

Well, the kludge worked for now--I have to be quite a bit more careful about being consistent about teasers vs. titles, but it works for the moment.

Jim Weisser
Tuesday, February 18, 2003

In the second replay to this topic, marktaw writes that there is no way yo get to the "foldername."

This should be corrected.  The page generator should be able to determine the foldername of the Article it is generating.  The template could then be coded to to insert slightly different code depending on the foldername.

I find myself writig almost identical templates for several different folders.  The difference is in the folder path they search for Articles and in the CSS class names they use for HTML elements.

These are both index templates, which list articles, and display templates for Articles.

I understand that I could handle the CSS issue with separate Style Sheets, but I do not want to add that level of complexity.


Joel Finkel
Thursday, February 20, 2003

I've added a sitemap example at . It might give you some ideas.


John Sisk
Thursday, February 20, 2003

*  Recent Topics

*  Fog Creek Home