<div><p style="font-size:50px;margin-top:0;margin-bottom:0">👍🏽</p><p style="margin-top:10px;margin-bottom:0">Simon reacted via <a href="https://www.google.com/gmail/about/?utm_source=gmail-in-product&utm_medium=et&utm_campaign=emojireactionemail#app">Gmail</a></p></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, 18 Mar 2025 at 21:27, Petko Yotov <<a href="mailto:5ko@5ko.fr">5ko@5ko.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You could add a custom page variable holding the first 4 letters of <br>
$Name:<br>
<br>
In local configuration:<br>
<br>
   $FmtPV['$Name04'] = 'substr($name, 0, 4)';<br>
<br>
And use that in a template:<br>
<br>
(:template first "{=$Name04}":)<br>
'''{=$Name04}:'''<br>
<br>
This may work best if the pagelist is ordered by name.<br>
<br>
Petko<br>
<br>
On 18/03/2025 09:08, Simon wrote:<br>
> Page list templates are a powerful and useful mechanism in PmWiki.<br>
> <br>
> I've got a use case where I have many page names prefixed by date -<br>
> i.e. "yyyy-mm-dd etc"<br>
> <br>
> I would like to group then into years, e.g. by something like this<br>
> <br>
> (:template first {(substr {=$Name} 0 4)}:)<br>
> <br>
> any suggestions on how I can achieve this.<br>
> As you may surmise the above does not work<br>
> <br>
> thanks<br>
> <br>
> Simon<br>
> <br>
> PS note interestingly I can do this<br>
> <br>
> (:template defaults year='{(substr {=$Name} 0 4)}':)<br>
> and use {$$year} successfully in the page list template<br>
> <br>
</blockquote></div>