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