ikiwiki/doc/todo/Allow_per-page_template_sel...

44 lines
1.7 KiB
Plaintext
Raw Normal View History

2007-05-24 18:56:42 +02:00
It'd be nice to be able to specify an altenate template file to be
used for some pages. For example, I'd like most of my pages to use
page.tmpl but I want my front page to be formatted in some unique way,
so I'd like it to use a separate front.tmp template instead.
I'm not sure what syntax to use for this, (\[[template]] seems to be
taken for another purpose already). Perhaps something like
\[[page-template front]] ?).
2007-05-29 20:54:59 +02:00
Joey provided a nice suggestion for implementing this feature, ("I
would probably add a hook that allowed overriding the default template
constuction and returning a template object"). I did start looking
into that, but finally I wimped out and just put the following hack
into the `genpage()` function in Render.pm:
2007-05-29 20:54:59 +02:00
if ($page eq 'index') {
$template->param(suppresstitle => 1);
}
That lets me use a `<TMPL_UNLESS SUPPRESSTITLE>` in my template to get
2007-05-29 20:54:59 +02:00
the effect I want. I don't think that's anything that upstream should
pick-up as is, (maybe with an appropriate configuration option, but
then again allowing for per-page template selection would be more
powerful anyway). But I'm happy enough now that I probably won't
pursue implementing this feature further myself.
But I'd still happily switch to using this feature if someone were to
implement it.
2007-07-03 20:42:08 +02:00
UPDATE: My latest hack is as follows:
if ($page eq 'index') {
$template->param(toplevelindex => 1);
}
And that's something that I'm not actually embarrassed to suggest
could be accepted upstream. Joey, what do you think? And would a
proper patch be helpful (it really just adds those lines to the right
place).
> Fully implemented as a templatefile hook and a [[plugins/pagetemplate]]
> plugin. --[[Joey]] [[done]]