3ffe5a8689c5eaf771eacf23f316b1db4b69cec9
[ikiwiki.git] / doc / plugins / contrib / trail.mdwn
1 [[!tag patch]]
2 [[!template id=gitbranch branch=smcv/trail author="[[smcv]]"]]
3
4 Available from [[smcv]]'s git repository, in the `trail` branch. This
5 plugin aims to solve [[todo/wikitrails]] in a simpler way; it can also be
6 used for [[navigation through blog posts|todo/Pagination_next_prev_links]].
7
8 Manual installation requires these files (use the "raw" link in gitweb to download):
9
10 * [trail.pm](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail:/IkiWiki/Plugin/trail.pm)
11   in an `IkiWiki/Plugin` subdirectory of your configured `plugindir`
12 * [page.tmpl](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail:/templates/page.tmpl)
13   and
14   [trails.tmpl](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail:/templates/trails.tmpl)
15   in your configured `templatedir`, or a `templates` subdirectory of your wiki repository
16 * the trail-related bits from the end of the
17   [stylesheet](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail:/doc/style.css)
18 * the trail-related bits at the end of the
19   [actiontabs](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail:/themes/actiontabs/style.css)
20   or [blueview](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail:/themes/blueview/style.css)
21   stylesheets, if you use one of those themes
22
23 The branch also includes [[todo/test_coverage]] machinery.
24
25 Demo:
26
27 * [in use on entries in my blog](http://smcv.pseudorandom.co.uk/)
28 * [a demo trail based on links](http://demo.hosted.pseudorandom.co.uk/trail/)
29 * [a demo hybrid trail/inline](http://demo.hosted.pseudorandom.co.uk/trail2/)
30
31 The page `e` is in both demo trails, to demonstrate how a page in more than
32 one trail looks.
33
34 The `smcv/trail2` branch is an older version of `trail` which used typed links
35 as its data structure, resulting in timing-related limitations (it couldn't
36 select pages for the trail by using pagespecs, because pagespecs can't be
37 evaluated correctly until the scan stage has finished).
38
39 Updated, November 2011:
40
41 * reinstated `inline` integration ([[report]] integration would probably be
42   pretty easy too, if this gets merged)
43 * switched from typed links back to a custom data structure to avoid
44   chicken/egg problems with ordering
45 * create typed links too, as a side-effect, but not when using an inline
46 * regression test with nearly full coverage
47 * CSS for the default anti-theme and all built-in themes (it looks nicest
48   in the default anti-theme and in actiontabs - the demo uses actiontabs)
49
50 Known bugs:
51
52 * the blueview and goldtype CSS nearly work, but the alignment is a bit off
53 * a `trailinline` with no `sort` option is sorted in arbitrary order
54
55 ----
56
57 [[!template id=plugin name=trail author="[[Simon_McVittie|smcv]]"]]
58 [[!tag type/chrome]]
59
60 This plugin provides the [[ikiwiki/directive/trail]],
61 [[ikiwiki/directive/traillink]], [[ikiwiki/directive/trailitem]],
62 and [[ikiwiki/directive/trailinline]] [[directives|ikiwiki/directive]].
63
64 It's sometimes useful to have "trails" of pages in a wiki where each
65 page links to the next and/or previous page. For instance, you could use
66 this for a guided tour, sequence of chapters, or sequence of blog posts.
67
68 In this plugin, a trail is represented by a page, and the pages in the
69 trail are indicated by specially marked links within that page, or by
70 including groups of pages with a [[ikiwiki/directive]].
71
72 If using the default `page.tmpl`, each page automatically displays the
73 trails that it's a member of (if any), with links to the trail and to
74 the next and previous members. HTML `<link>` tags with the `prev`,
75 `next` and `up` relations are also generated.
76
77 Pages can be included in a trail in various ways:
78
79 * The [[ikiwiki/directive/trailinline]] directive sets up an [[inline]],
80   and at the same time adds the matching pages (from `pages` or `pagenames`)
81   to the trail. One use is to navigate through all posts in a blog:
82
83         \[[!trailinline pages="page(./posts/*) and !*/Discussion" archive=yes
84           feedshow=10 quick=yes]]
85
86   This directive only works if the [[!iki plugins/inline desc=inline]]
87   plugin is also enabled.
88
89 * The [[ikiwiki/directive/trail]] directive has optional `pages` and
90   `pagenames` options which behave the same as in [[inline]], but don't
91   produce any output in the page, so you can have trails that don't list
92   all their pages.
93
94 * The [[ikiwiki/directive/traillink]] directive makes a visible link
95   and also adds the linked page to the trail. This will typically be
96   used in a bullet list, but could also be in paragraph text:
97
98         * [[!traillink Introduction]]
99         * [[!traillink "Chapter 1"]]
100         * [[!traillink Chapter_2]]
101         * [[!traillink Appendix_A]]
102
103   or
104
105         To use this software you must \[[!traillink install]] it,
106         \[[!traillink configuration text="configure it"]],
107         and finally \[[!traillink running|run_it]].
108
109   This also counts as a [[ikiwiki/WikiLink]] for things like the `link()`
110   [[ikiwiki/PageSpec]] item.
111
112 * The [[ikiwiki/directive/trailitem]] directive adds a page to the trail
113   like `traillink`, but produces an invisible link, rather like `\[[!tag]]`:
114
115         To use this software you must \[[!traillink install]] it,
116         \[[!trailitem installing_from_packages]]
117         \[[!trailitem installing_from_source]]
118         \[[!traillink configuration text="configure it"]],
119         and finally \[[!traillink running|run_it]].
120         \[[!trailitem troubleshooting]]
121
122   Like `\[[!tag]]`, this still counts as a [[ikiwiki/WikiLink]] even though
123   there's no visible link.
124
125 You can mix several of these directives in one page, and the resulting
126 trail will contain all of the pages matched by any of the directives,
127 in the same order as the directives (unless you use the `sort` option
128 on `\[[!trail]]` or `\[[!trailinline]]`, which takes precedence).
129
130 The [[ikiwiki/directive/trail]] directive can also be used to set options.