Wiki Trails

The WikiTrails feature allows wiki authors to create "trails" through sequences of pages in the wiki.

Creating a trail

To create a trail, an author creates a "trail index page" that gives the sequence of page names as either a bullet or numbered list. The page names must be the first item following each bullet.

To give an example for the function of the trail index page: A WikiTrail like

  
  * [[TrailPage1]]
  * Some text.
  * [[TrailPage2]]
  ** [[TrailPage3]]
  ** [[TrailPage4]] some other text [[IrrelevantWikiPage]]
  ** Yet some other text. [[AnotherIrrelevantWikiPage]] 

creates the following "trail":

  WikiPage1 <-> WikiPage2 <-> WikiPage4 <-> WikiPage4 

Observations:

  1. Indentation levels in the page list don't matter. PmWiki simply transforms it into a linear list of pages.
  2. Text that isn't a link doesn't matter, too.
  3. Only the first link in a list item matters, and only if no non-link text precedes it.

Using the trail

Creating the trail doesn't do anything actually. In fact any page with numbered or bulleted lists will implicitly create a trail, intentionally or not. What makes the trail "work" is adding the appropriate markup on the trail pages (i.e. those pages that are listed in the bullet/numbered list).

To acknowledge a page for the trail, add the markup <<|TrailIndexPage|>> somewhere on it. You can place the markup anywhere you like, and in as many places as you like; good places are at the top and/or bottom of each trail page.

When a page with such a markup is displayed, PmWiki does the following things:

  1. Extract a list of pages (the "trail") from bulleted/numbered list items in TrailIndexPage.
  2. Displays something like "<< PreviousPage | TrailIndexPage | NextPage >>", where PreviousPage and NextPage are links to the previous and next pages as listed in the trail.
  3. If the current page doesn't exist in the trail, displays simply <<|TrailIndexPage|>>.

Trail page markup can be varied in various ways:

  • You can use ^ instead of <<...>> like this: ^|TrailIndexPage|^. This will not display the previous and next page in the list, instead it will show a "breadcrumb trail" that shows "how to get here": first the trail index page, then the name of the page itself. If the page was on a subitem in the bullet/numbered list, the last item of the list will also show. Taking the example trail index above, trail page 2 would display TrailIndexPage | TrailPage2, trail page 3 would display TrailIndexPage | TrailPage2 | TrailPage3, and on trail page 4 it would be TrailIndexPage | TrailPage2 | TrailPage4.
  • A single ... will not display arrows at the "ends" of the trail (where a page is the first or last page in the trail).
  • Enclosing the name of the trail index page as in <|[[TrailIndexPage]]|> will turn it into a link in the text that PmWiki generates. (Normally it isn't.)
  • Other double square bracket variations work as well, such as <|[[TrailIndexPage | Nicer text for trail index page]]|>

Fun Stuff with trails

Normally, a trail is a linear list with a first and a last item. However, you can make it circular by adding the first item at the end of the trail index page:

  
  * [[TrailPage1]]
  * [[TrailPage2]]
  ...
  * [[TrailPageN]]
  * [[TrailPage1]]
  

If the trail index page is intended to be visible to end users, you might want to hide that last list item that closes the circle. In that case, simply make it invisible:

  
  * [[TrailPage1]]
  * [[TrailPage2]]
  ...
  * [[TrailPageN]]
  * [[TrailPage1]] %item comment%
  

Other notes

The %trail% markup used in PmWiki's documentation pages is just a WikiStyle that creates a grey background, and is not required for WikiTrails to work. It's defined in the PmWiki.GroupHeader page.

You can embed brackets inside a trail as in <<|[[PmWiki/Documentation Index]]|>> or <<|[[PmWiki/Documentation Index | Up]]|>>.

<< GroupHeaders | PmWiki.DocumentationIndex | Page history >>