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