Log in Sign up

{{last}} is not defined inside {{archives}}

I know {{^last}}{{/last}} does work on Blot in principle, considering this question.

However, it does not seem to work with {{#entries}}, even though some templates try to make use of it. Specifically, I am talking about the "Index" template, which tries to do the following on its archives.html part:

  {{#entries}}
  <a class="archive" href="{{{url}}}">{{title}}</a>{{^last}}&nbsp;&nbsp;·&nbsp;{{/last}}
  {{/entries}}

In case of three posts in a single month, e. g. "abc", "def" and "ghi", I would expect the following to appear on the archives page:

abc  ·  def  ·  ghi

However, the {{^last}}{{/last}} block never seems to be executed, which leaves me with:

abc def ghi

(The spaces are probably added because of the line break in the HTML code.) I suspect that the items of {{#entries}} do not even have a last-property, which is why Mustache evaluates it to "false" (for all items)? Or is there some other problem? This happens with a freshly forked "Index" template, so I think it should work out of the box.


10 months ago, 2 replies   developers   bug   resolved   Edit question

After some more investigations using ?debug=true, it really appears like the last element is simply missing. There is first and position, which means it is possible to slightly modify the template to use first. But in my opinion this is a bug and I am somewhat surprised nobody has cared about it so far.

Answered a year ago · Edit answer

I believe we emailed about this – I didn't actually check whether or not last was even defined – this was a bug with the archives object which I have fixed

Answered 10 months ago · Edit answer