add test case to ensure all templates are documented
[ikiwiki] / doc / templates.mdwn
1 [[Ikiwiki]] uses many templates for many purposes. By editing its templates,
2 you can fully customise this site.
3
4 [[!if test="enabled(template)" then="""
5 ## The template directive
6
7 The template directive allows wiki pages to be used as templates.
8 These templates can be filled out and inserted into other pages in the
9 wiki using the directive.
10 """]]
11 [[!if test="enabled(template) and enabled(inline)" then="""
12 [[!inline pages="templates/* and !*/discussion" feeds=no archive=yes
13 sort=title template=titlepage
14 rootpage=templates postformtext="Add a new template named:"]]
15 """]]
16
17 [[!if test="enabled(edittemplate)" then="""
18 ## The edittemplate directive
19
20 The edittemplate directive can be used to make new pages default to
21 containing text from a template, which can be filled as out the page is
22 edited.
23 """]]
24
25 ## Wiki templates
26
27 These templates are used to build the wiki. The aim is to keep almost all
28 html out of ikiwiki and in the templates.
29
30 * `page.tmpl` - Used for displaying all regular wiki pages.
31 * `misc.tmpl` - Generic template used for any page that doesn't
32   have a custom template.
33 * `rsspage.tmpl` - Used for generating rss feeds for blogs.
34 * `rssitem.tmpl` - Used for generating individual items on rss feeds.
35 * `atompage.tmpl` - Used for generating atom feeds for blogs.
36 * `atomitem.tmpl` - Used for generating individual items on atom feeds.
37 * `inlinepage.tmpl` - Used for displaying a post in a blog.
38 * `archivepage.tmpl` - Used for listing a page in a blog archive page.
39 * `titlepage.tmpl` - Used for listing a page by title in a blog archive page.
40 * `microblog.tmpl` - Used for showing a microblogging post inline.
41 * `blogpost.tmpl` - Used for a form to add a post to a blog (and a rss/atom links)
42 * `feedlink.tmpl` - Used to add rss/atom links if `blogpost.tmpl` is not used.
43 * `aggregatepost.tmpl` - Used by the aggregate plugin to create
44   a page for a post.
45 * `searchform.tmpl`, `googleform.tmpl` - Used by the search plugin 
46   and google plugin to add search forms to wiki pages.
47 * `searchquery.tmpl` - This is a Omega template, used by the
48   search plugin.
49 * `comment.tmpl` - Used by the comments plugin to display a comment.
50 * `change.tmpl` - Used to create a page describing a change made to the wiki.
51 * `recentchanges.tmpl` - Used for listing a change on the RecentChanges page.
52 * `autoindex.tmpl` - Filled in by the autoindex plugin to make index pages.
53 * `autotag.tmpl` - Filled in by the tag plugin to make tag pages.
54 * `calendarmonth.tmpl`, `calendaryear.tmpl` - Used by ikiwiki-calendar to
55   make calendar archive pages.
56 * `editpage.tmpl`, `editconflict.tmpl`, `editcreationconflict.tmpl`,
57   `editfailedsave.tmpl`, `editpagegone.tmpl`, `pocreatepage.tmpl`,
58   `editcomment.tmpl` `commentmoderation.tmpl`, `renamesummary.tmpl`,
59   `passwordmail.tmpl` - Parts of ikiwiki's user interface; do not
60   normally need to be customised.
61
62 [[!if test="enabled(pagetemplate)" then="""
63 ## The pagetemplate directive
64
65 The pagetemplate directive can allow individual pages to use a
66 different template than `page.tmpl`.
67 """]]
68
69 ## Template locations
70
71 Templates are located in `/usr/share/ikiwiki/templates` by default;
72 the `templatedir` setting can be used to make another directory be
73 searched first. Customized templates can also be placed inside the
74 "templates/" directory in your wiki's source.
75
76 ## Template syntax
77
78 Ikiwiki uses the HTML::Template module as its template engine. This
79 supports things like conditionals and loops in templates and is pretty easy
80 to learn. All you really need to know are a few things:
81
82 * To insert the value of a template variable, use `<TMPL_VAR variable>`.
83 * To make a block of text conditional on a variable being set use
84   `<TMPL_IF NAME="variable">text</TMPL_IF>`.
85 * To use one block of text if a variable is set and a second if it's not,
86   use `<TMPL_IF NAME="variable">text<TMPL_ELSE>other text</TMPL_IF>`
87
88 [[!meta robots="noindex, follow"]]