]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/Allow_per-page_template_selection.mdwn
Added link to plugins/contrib/created_in_future
[ikiwiki.git] / doc / todo / Allow_per-page_template_selection.mdwn
1 It'd be nice to be able to specify an altenate template file to be
2 used for some pages. For example, I'd like most of my pages to use
3 page.tmpl but I want my front page to be formatted in some unique way,
4 so I'd like it to use a separate front.tmp template instead.
5
6 I'm not sure what syntax to use for this, (\[[template]] seems to be
7 taken for another purpose already). Perhaps something like
8 \[[page-template front]] ?).
9
10 Joey provided a nice suggestion for implementing this feature, ("I
11 would probably add a hook that allowed overriding the default template
12 constuction and returning a template object"). I did start looking
13 into that, but finally I wimped out and just put the following hack
14 into the `genpage()` function in Render.pm:
15
16
17         if ($page eq 'index') {
18                 $template->param(suppresstitle => 1);
19         }
20
21 That lets me use a `<TMPL_UNLESS SUPPRESSTITLE>` in my template to get
22 the effect I want. I don't think that's anything that upstream should
23 pick-up as is, (maybe with an appropriate configuration option, but
24 then again allowing for per-page template selection would be more
25 powerful anyway). But I'm happy enough now that I probably won't
26 pursue implementing this feature further myself.
27
28 But I'd still happily switch to using this feature if someone were to
29 implement it.
30
31 UPDATE: My latest hack is as follows:
32
33         if ($page eq 'index') {
34                 $template->param(toplevelindex => 1);
35         }
36
37 And that's something that I'm not actually embarrassed to suggest
38 could be accepted upstream. Joey, what do you think? And would a
39 proper patch be helpful (it really just adds those lines to the right
40 place).
41
42 > Fully implemented as a templatefile hook and a [[plugins/pagetemplate]]
43 > plugin. --[[Joey]] [[done]]