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