]> sipb.mit.edu Git - ikiwiki.git/blob - doc/pagespec.mdwn
web commit by JoshTriplett: Fill in mentors, administrators, item 13 "What criteria...
[ikiwiki.git] / doc / pagespec.mdwn
1 To select a set of pages, such as pages that are locked, pages
2 whose commit emails you want subscribe to, or pages to combine into a
3 blog, the wiki uses a PageSpec. This is an expression that matches
4 a set of pages.
5
6 The simplest PageSpec is a simple list of pages. For example, this matches
7 any of the three listed pages:
8
9         foo or bar or baz
10
11 More often you will want to match any pages that have a particular thing in
12 their name. You can do this using a glob pattern. "`*`" stands for any part
13 of a page name, and "`?`" for any single letter of a page name. So this
14 matches all pages about music, and any [[SubPage]]s of the SandBox, but does
15 not match the SandBox itself:
16
17         *music* or SandBox/*
18
19 You can also prefix an item with "`!`" to skip pages that match it. So to
20 match all pages except for Discussion pages and the SandBox:
21
22         * and !SandBox and !*/Discussion
23
24 Some more elaborate limits can be added to what matches using any of these
25 functions:
26
27 * "`link(page)`" - match only pages that link to a given page
28 * "`backlink(page)`" - match only pages that a given page links to
29 * "`creation_month(month)`" - match only pages created on the given month
30 * "`creation_day(mday)`" - or day of the month
31 * "`creation_year(year)`" - or year
32 * "`created_after(page)`" - match only pages created after the given page
33   was created
34 * "`created_before(page)`" - match only pages created before the given page
35   was created
36
37 For example, to match all pages in a blog that link to the page about music
38 and were written in 2005:
39
40         blog/* and link(music) and creation_year(2005)
41
42 More complex expressions can also be created, by using parentheses for
43 grouping. For example, to match pages in a blog that are tagged with either
44 of two tags, use:
45
46         blog/* and (link(tag/foo) or link(tag/bar))
47
48 Note that page names in PageSpecs are matched against the absolute
49 filenames of the pages in the wiki, so a pagespec "foo" used on page
50 "a/b" will not match a page named "a/foo" or "a/b/foo". To match
51 relative to the directory of the page containing the pagespec, you can
52 use "./". For example, "./foo" on page "a/b" matches page "a/foo".
53
54 ## Old syntax
55
56 The old PageSpec syntax was called a "GlobList", and worked differently in
57 two ways:
58
59 1. "and" and "or" were not used; any page matching any item from the list
60    matched.
61 2. If an item was prefixed with "`!`", then no page matching that item
62    matched, even if it matched an earlier list item.
63
64 For example, here is the old way to match all pages except for the SandBox
65 and Discussion pages:
66
67         * !SandBox !*/Discussion
68
69 Using this old syntax is still supported. However, the old syntax is
70 deprecated and will be removed at some point, and using the new syntax is
71 recommended.