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