Reverse detail from Kakelbont MS 1, a fifteenth-century French Psalter. This image is in the public domain. Daniel Paul O'Donnell

Forward to Navigation

How to do a table of contents in text pattern

Posted: Feb 19, 2014 15:02;
Last Modified: Feb 19, 2014 16:02
Keywords:

---

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). In the interests of remembering, here it is:

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

The only downside of this plugin is that you need to have IDs attached to every header you want to show up in the TOC. You add an ID in textpattern like this: h2(#IDREF). If you are in a rush, you can always just use (#A), (#B), (#C) (remember, IDREFs can’t start with a number in XML).

----  

Comment

:
:

:

Textile help

Back to content

Search my site

Sections

Current teaching

Recent changes to this site

Tags

anglo-saxon studies, caedmon, citation practice, composition, computers, digital humanities, digital pedagogy, grammar, history, moodle, old english, pedagogy, research, students, study tips, teaching, tips, tutorials, unessay, universities

See all...

Follow me on Twitter