Daniel Burrows wrote:
>   I would like to be able to change the page template in a subdirectory
> of my wiki.  The natural ikiwiki-ish way to do this would seem to be to
> have a SubPage named "page.tmpl" that's used instead of the default
> page.tmpl.  An example use case is that I want to put a special footer
> on blog posts, but not on the whole wiki.
> 
>   I've got a hacky fix for my needs in the attached plugin, which will
> search for page.tmpl using SubPage rules and make it the default page
> template if possible.  To use it, set the templatedir to the same
> value as srcdir so ikiwiki can pick up templates from its input
> directory.

I don't like the idea of putting the templates in the wiki with the
other files. It's probably fine in your particular case, but in general
ikiwiki makes sure that any files in the wiki are passed through the
htmlscrubber, to guard against XSS attacks. Which won't work for these
templates.

You could use the pagetemplate plugin, which makes a single page use a
different template from the standard templatedir. I guess you don't want
to bother with putting a call to pagetemplate on every blog page though.

The two approaches that seem best to me are either modifying your plugin
to look in the templatedir for the templates while otherwise keeping the
subpage-ish lookup, or modifying pagetemplate so a given template can be
applied to any pages matching a given PageSpec. Luckily the upcoming
ikiwiki 2.16 has the per-plugin data storage that this latter approach
needs.

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature

Reply via email to