Merge branch 'master' into templatemove
[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 * `editpage.tmpl` - Create/edit page.
34 * `change.tmpl` - Used to create a page describing a change made to the wiki.
35 * `passwordmail.tmpl` - Not a html template, this is used to
36   generate a mail with an url the user can use to reset their password.
37 * `rsspage.tmpl` - Used for generating rss feeds for [[blogs|blog]].
38 * `rssitem.tmpl` - Used for generating individual items on rss feeds.
39 * `atompage.tmpl` - Used for generating atom feeds for blogs.
40 * `atomitem.tmpl` - Used for generating individual items on atom feeds.
41 * `inlinepage.tmpl` - Used for adding a page inline in a blog
42   page.
43 * `archivepage.tmpl` - Used for listing a page in a blog archive page.
44 * `microblog.tmpl` - Used for showing a microblogging post inline.
45 * `blogpost.tmpl` - Used for a form to add a post to a blog (and a rss/atom links)
46 * `feedlink.tmpl` - Used to add rss/atom links if blogpost.tmpl is not used.
47 * `aggregatepost.tmpl` - Used by the [[plugins/aggregate]] plugin to create
48   a page for a post.
49 * `searchform.tmpl` - Used by the [[plugins/search]] plugin to add a search
50   form to wiki pages.
51 * `searchquery.tmpl` - This is an omega template, used by the
52   [[plugins/search]] plugin.
53 * `comment.tmpl` - This template is used to display a comment
54   by the [[plugins/comments]] plugin.
55 * `editcomment.tmpl` - This template is the comment post form for the
56   [[plugins/comments]] plugin.
57 * `commentmoderation.tmpl` - This template is used to produce the comment
58   moderation form.
59 * `recentchanges.tmpl` - This template is used for listing a change
60   on the RecentChanges page.
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"]]