Your sites Log in Sign up Menu

Scope of tag names

I'm a bit confused about the scope of tag names from the Reference page:

For example, the reference lists blog.title and entry.title, but on the entries.html they don't seem to work for me. However the unqualified title does work.


2 years ago, 1 replies   Improve this question

Only the template view entry.html is supplied a single entry, corresponding to its permalink, whose title you can render like this:

<h1>{{entry.title}}</h1>

The template view entries.html is supplied a list of entries, paginated. You can render a list of their titles like so:

<ul>
  {{#entries}}
    <li>{{title}}</li>
  {{/entries}}
</ul>

At the moment, in contrast to what the docs claim, the blog properties are assigned to the top-level context, so {{title}} will refer to blog.title by default:

<p>This will show my blog's title:</p>
<h1>{{title}}</h1>
<p>This will show my most recent entry's title:</p>
<h1>{{#allEntries}}{{#first}}{{title}}{{/first}}{{/allEntries}}</h1>

I plan to eventually nest all the blog properties under {{blog}} but the template rendering engine hasn't caught up to the documentation yet. If in doubt, please follow the conventions followed by the templates. Please let me know if you have any questions about this or anything else.

Answered 2 years ago · Improve this answer