1 The `if` directive is supplied by the [[!iki plugins/conditional desc=conditional]] plugin.
3 With this directive, you can make text be conditionally displayed on a page.
6 \[[!if test="enabled(smiley)"
7 then="The smiley plugin is enabled :-)"
8 else="No smiley plugin here.."]]
10 If the specified `test` succeeds, the `then` text will be displayed,
11 otherwise the `else` text will be displayed. The `else` part is optional.
13 The `then` and `else` values can include any markup that would be allowed
14 in the wiki page outside the template. Triple-quoting the values even allows
15 quotes to be included.
17 The `test` is a [[ikiwiki/PageSpec]]; if it matches any page in the wiki
18 then it succeeds. So you can do things like testing for the existence of a
19 page or pages, testing to see if any pages were created in a given month,
22 If you want the [[ikiwiki/PageSpec]] to only match against the page that
23 contains the conditional, rather than matching against all pages in the
24 wiki, set the "all" parameter to "no".
26 In an `if` directive, the regular [[ikiwiki/PageSpec]] syntax is expanded
27 with the following additional tests:
31 Tests whether the specified plugin is enabled.
35 Tests whether the glob matches the name of the page that contains the
40 Tests whether the glob matches the name of the page that is being built.
41 That might be different than the name of the page that contains the
42 conditional, if it's being inlined into another page.
46 Tests whether the page is being included onto another page, for example
47 via [[inline]] or [[map]]. Note that pages inserted into other pages
48 via [[template]] are not matched here.
50 [[!meta robots="noindex, follow"]]