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