In my wiki I have a template page under `/templates` that looks like this:

    \[[!inline                                                                       
          pages="<TMPL_VAR PAGE>/* and !<TMPL_VAR PAGE>/*/*"                    
          show=0                                                                
          template=titlepage                                                    
          feeds=no                                                              
          sort=title]]                                                          
                                                                                    
    \[[!trailitems                                                                   
              pages="<TMPL_VAR PAGE>/* and !<TMPL_VAR PAGE>/*/*"                
              sort=title]]

I tested this page with many variations and by trial and error reached a conclusion that
when using `trailitems` with a path that contains TMPL_VAR, or using the inline directive
with `trail=yes` and a `pages` that contains TMPL_VAR, the trail plugin (or something else?)
seems to not resolve the TMPL_VAR and ikiwiki fails to compile the wiki, and I get this:

    syntax error in pagespec "<TMPL_VAR PAGE>/* and !<TMPL_VAR PAGE>/*/*"

on the command line.

Until I get feedback here I'll try to look at the source and see if I figure it out.
My ikiwiki version: 3.20130904

Huge thanks in advance!

--[[fr33domlover]]

> These templates have traditionally had a problem: they need to be
> simultaneously a valid page in their own right, and a valid page after
> template substitutions.
>
> In newer ikiwiki versions, the [[ikiwiki/directive/templatebody]]
> directive [[solves this|done]] ... but your ikiwiki is nearly a year
> and a half old, so you don't have recent bugfixes.
>
> You might be able to get somewhere by abusing the two intersecting
> markup languages, something like this:
>
>     <TMPL_IF FALSE>
>     \[[!if test="included() and !included()" then="""
>     </TMPL_IF>
>     ... real content here: inline, trailitems etc. ...
>     ... just don't use a triple quote mark ...
>     <TMPL_IF FALSE>
>     """]]
>     </TMPL_IF>
>
> Alternatively, if you have direct commit access and don't need
> to be able to perform web-based edits on your template, I think
> renaming your template from `foo.mdwn` to `foo.tmpl` would bypass
> this while still working as a template. --[[smcv]]
