I fixed my problem with creating an automatic index of "category" pages. It involved getting pretty intimate with Tinderbox export codes (incidentally, the Tinderbox Wiki has a very useful reference page for export codes). The process was non-obvious enough that it might bear recording here (non-Tinderbox readers may want to skip to the next post).
Pretty soon after starting this blog, I decided I wanted to be able to collect thematically related posts into a single page. That was easy to do with a custom attribute called Category and set of Tinderbox agent that searched this attribute for different keywords or phrases. That method also allowed me to collect the same note in multiple categories if it seemed to speak to belong in more than one (like this one). A Categories note among the blog's other sidebar items provided the links to the various agent pages. The downside was that every time I wanted to revise or expand my categories (and this happened frequently in the early going), I had to edit the Categories note and add a new link, which was not very hard but tiresome enough to wish to avoid the task.
I still have a note called Categories, but now it serves as a container for all the agents. The Categories note is set to not export to HTML, while the agents are set to export using the standard page template. This arrangement also had the fortuitous result of achieving something else I had wanted to do but couldn't figure out: all the category pages get exported to a subdirectory (called categories) of the blog instead of adding to the clutter of files on the main level.
The trickier part was figuring out how to generate the automatic list of Category links for each page. I had thought that
^childLinks^ would do this, but I never got that method to work. Instead, I am using a string of export templates to get what I want. The main page template includes the following export code:
^include(Categories, childList.html)^. That is, it pulls in the Categories container using the childList.html template. That template is very simple: it uses
^justChildren^ to pull in only the immediate chidlren of Categories (i.e., the agents, but not the notes that the agents collect). Finally, the childItem.html template does the real work. For each agent, the template applies the following:
First, this checks to make sure the agent is not empty (no posts matching its query; I do have a couple of categories set up in anticipation that I will write posts for them in the future) and, as long as it is not, it creates a link to its location (
^linkTo(this)^) and, just for fun, displays the number of posts in that category as well. Empty agents are simply skipped.
Now, whenever I want to add a new collection to the category list, I can just create a new agent in Categories, and the next time I export, the new page will be created and a link to it added to all the other pages. So far, my category pages are only searches on the Category attribute, but Agents can search all manner of things, so the possibilities are endless. About my only grumble about the current solution is I'd like to have the categories appear between the syndication link and the blogroll, but those are being
^included as a block (along with the About statement), and the categories need to follow different rules than the other items. It wouldn't be terribly hard to rewrite the page template to put things in the order I want, and I suppose if it bothers me enough, I'll do just that. For now, I am pretty happy.