]> sipb.mit.edu Git - ikiwiki.git/blob - doc/templates.mdwn
as usual, macports hasn't moved
[ikiwiki.git] / doc / templates.mdwn
1 [[Ikiwiki]] uses many templates for many purposes. By editing its templates,
2 you can fully customise its appearance, and avoid duplicate content.
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 [[!if test="enabled(template) or enabled(edittemplate)" then="""
15 ## template pages
16
17 Template pages are regular wiki pages containing a
18 [[!iki ikiwiki/directive/templatebody desc="templatebody directive"]],
19 used as templates for other pages. The parts of the template
20 page outside the directive can be used to document it.
21 """]]
22
23 [[!if test="enabled(template)" then="""
24 The [[!iki ikiwiki/directive/template desc="template directive"]] allows
25 template pages to be filled out and inserted into other pages in the wiki.
26 """]]
27
28 [[!if test="enabled(edittemplate)" then="""
29 The [[!iki ikiwiki/directive/edittemplate desc="edittemplate directive"]] can
30 be used to make new pages default to containing text from a template
31 page, which can be filled out as the page is edited.
32 """]]
33
34 [[!if test="(enabled(template) or enabled(edittemplate))
35 and enabled(inline)" then="""
36 These template pages are currently available:
37
38 [[!inline pages="templates/* and !*.tmpl and !templates/*/* and !*/discussion"
39 feeds=no archive=yes sort=title template=titlepage
40 rootpage=templates postformtext="Add a new template page named:"]]
41 """]]
42
43 If the template does not contain a `templatebody` directive, the entire
44 source of the page is used for the template. This is deprecated.
45
46 ## template files
47
48 Template files are unlike template pages in that they have the extension
49 `.tmpl`. Template files are used extensively by Ikiwiki to generate html.
50 They can contain html that would not normally be allowed on a wiki page.
51
52 Template files are located in `/usr/share/ikiwiki/templates` by default;
53 the `templatedir` setting can be used to make another directory be
54 searched first. Customised template files can also be placed inside the
55 "templates/" directory in your wiki's source -- files placed there override
56 ones in the `templatedir`.
57
58 Here is a full list of the template files used:
59
60 * `page.tmpl` - Used for displaying all regular wiki pages. This is the
61   key template to customise to change the look and feel of Ikiwiki.
62   [[!if test="enabled(pagetemplate)" then="""
63   (The [[!iki ikiwiki/directive/pagetemplate desc="pagetemplate directive"]]
64   can be used to make a page use a different template than `page.tmpl`.)"""]]
65 * `rsspage.tmpl` - Used for generating rss feeds for blogs.
66 * `rssitem.tmpl` - Used for generating individual items on rss feeds.
67 * `atompage.tmpl` - Used for generating atom feeds for blogs.
68 * `atomitem.tmpl` - Used for generating individual items on atom feeds.
69 * `inlinepage.tmpl` - Used for displaying a post in a blog.
70 * `archivepage.tmpl` - Used for listing a page in a blog archive page.
71 * `titlepage.tmpl` - Used for listing a page by title in a blog archive page.
72 * `microblog.tmpl` - Used for showing a microblogging post inline.
73 * `blogpost.tmpl` - Used for a form to add a post to a blog (and rss/atom links)
74 * `feedlink.tmpl` - Used to add rss/atom links if `blogpost.tmpl` is not used.
75 * `aggregatepost.tmpl` - Used by the aggregate plugin to create
76   a page for a post.
77 * `searchform.tmpl`, `googleform.tmpl` - Used by the search plugin 
78   and google plugin to add search forms to wiki pages.
79 * `searchquery.tmpl` - This is a Omega template, used by the
80   search plugin.
81 * `comment.tmpl` - Used by the comments plugin to display a comment.
82 * `change.tmpl` - Used to create a page describing a change made to the wiki.
83 * `recentchanges.tmpl` - Used for listing a change on the RecentChanges page.
84 * `autoindex.tmpl` - Filled in by the autoindex plugin to make index pages.
85 * `autotag.tmpl` - Filled in by the tag plugin to make tag pages.
86 * `calendarmonth.tmpl`, `calendaryear.tmpl` - Used by ikiwiki-calendar to
87   make calendar archive pages.
88 * `trails.tmpl` - Used by the trail plugin to generate links on each page
89   that is a member of a trail.
90 * `notifyemail.tmpl` - Used by the notifymail plugin to generate mails about
91   changed pages.
92 * `editpage.tmpl`, `editconflict.tmpl`, `editcreationconflict.tmpl`,
93   `editfailedsave.tmpl`, `editpagegone.tmpl`, `pocreatepage.tmpl`,
94   `editcomment.tmpl` `commentmoderation.tmpl`, `renamesummary.tmpl`,
95   `passwordmail.tmpl`, `openid-selector.tmpl`, `revert.tmpl` - Parts of ikiwiki's user
96   interface; do not normally need to be customised.
97
98
99 [[!meta robots="noindex, follow"]]