Summary: Dynamic WikiTrails with pagelist
Version: 1
Prerequisites: pmwiki 2.1
Status: experimental
Discussion: DynamicTrails-Talk

Questions answered by this recipe

How can I create a trail through the pages of a group without having a trailpage?

This section is optional; use it to indicate the types of questions (if any) this recipe is intended to answer.


Add the following pagelist template formats to your Site.LocalTemplates and pagelist trail markup to the group's GroupHeader or GroupFooter page:

Make sure the pagelist markup doesn't have the list=normal argument which excludes the current page from the list. We need the current page to be among the found pages in order to detect the previous and next pages.

Dynamic trail of form prev.Name | Group | next.Name

(:template each :)
(:if equal {*$FullName} {=$FullName}:)
%wikitrail%[[{<$FullName}|+]] | [[{*$Groupspaced}]] | [[{>$FullName}|+]]
(:pagelist group={*$Group} fmt=#grouptrail :)

Dynamic trail of form <<prev | Group | next>>

(:template each :)
(:if equal {*$FullName} {=$FullName}:)
%wikitrail%[[{<$FullName}| &laquo; prev ]] | [[{*$Groupspaced}]] | [[{>$FullName}| next &raquo; ]]
(:pagelist group={*$Group} fmt=#grouptrail2 :)

The trail markup will link to previous and next pages in the group, and to the group's homepage. The group's homepage does not need to contain a list of pages, the pagelist markup is generating the trail links.

To make sure that RecentChanges and GroupFooter don't show up in the navigation when using the Dynamic Trails recipe, use a list= option in your pagelist markup that will include the current page but omit the undesired ones. PmWiki's built-in list=normal option omits the current page, so it won't work with this recipe. See the Talk page or Cookbook:SearchPatterns for how to create a custom list= option that includes the current page, so you can use markup such as:

(:pagelist group={$Group} fmt=#grouptrail list=normalself :)

To understand the use of the "*$" markup see page variable special references and pagelist template special references.

Variation: fmt=#nextontrail

Dynamic trail of form NextPageName link

(:if equal {*$FullName} {=$FullName}:)
Next page: [[{>$FullName}|+]]
(:pagelist group={*$Group} fmt=#nextontrail list=normal:)


Release Notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See Also



See discussion at DynamicTrails-Talk

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.