DynamicTrails
Questions answered by this recipe
How can I create a trail through the pages of a group without having a trailpage?
Description
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
[[#grouptrail]] (:template each :) (:if equal {*$FullName} {=$FullName}:) %wikitrail%[[{<$FullName}|+]] | [[{*$Groupspaced}]] | [[{>$FullName}|+]] (:ifend:) [[#grouptrailend]]
(:pagelist group={*$Group} fmt=#grouptrail :)
Dynamic trail of form <<prev | Group | next>>
[[#grouptrail2]] (:template each :) (:if equal {*$FullName} {=$FullName}:) %wikitrail%[[{<$FullName}| « prev ]] | [[{*$Groupspaced}]] | [[{>$FullName}| next » ]] (:ifend:) [[#grouptrail2end]]
(: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
[[#nextontrail]] (:if equal {*$FullName} {=$FullName}:) Next page: [[{>$FullName}|+]] (:ifend:) [[#nextontrailend]]
(:pagelist group={*$Group} fmt=#nextontrail list=normal:)
Notes
Release Notes
See Also
- Cookbook:PageListWikiTrail - put pagelists inside of wikitrail index pages
- Cookbook:PageListExtensions - pagelist enhancements (can do even more with the above recipe with this)
- Cookbook:DynamicWikiTrails - put pages on multiple trails
- PagelistVariables - Variables used with page lists and search results
- PageLists - Searching and listing pages by multiple criteria with templated output
- PageListTemplates - Creating page list format templates
- PowerTools#trail - markup expression to create dynamic trail links
Contributors
Comments
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.