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