Code for table of contents in text pattern

Use the following to put in a table of contents in a text pattern page.

<div id="TOC">
   <txp:soo_toc label="Contents" labeltag="h3"/>
</div>

The code will build a TOC for every header that has an IDREF. An example would look like this: h3(#thisIsTheID).

tags: , , ,


How to do a table of contents in text pattern

My teaching pages are served out using Textpattern, a relatively light CMS that uses textile wiki-like markup.

Because adding an excerpt by hand wrecks the syndication of this site through Wordpress to my other blog, I don’t usually add a text summary. Instead, I do something similar to the Wikipedia or Wordpress: I begin articles with an abstract like first paragraph, then include a table of contents, then have the rest of the body.

I used to make up these tables of content by hand, cursing all the time that Textile wasn’t XML. Then I discovered soo_toc, a Textpattern plugin that builds tables of contents dynamically. Joy!

Of course, now I need to remember to add the template that calls the TOC to each page (as I type this, I wonder if there might not be a simple variable I could develop that does this, but that’s for later). Read the rest of this entry »


Follow

Get every new post delivered to your Inbox

Join other followers: