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