Your sites Log in Sign up Menu

{{#unless page}} not working?

Hi, I am trying to render some elements in an entry.html template only if it is a post but not a page. To do so, I have:

          {{#unless page}}
          <div id="TOC">
            {{> toc}}
          </div>
          {{/unless}}

so that I can only load a table of contents on appropriate pages. However, this seems to not work. On all views, whether page or post, this seems to still load the toc. What is happening? What might I be doing wrong?


3 years ago, 1 replies   Improve this question

ah, I found my own answer. unless is a handlebars keyword, but isn't available in mustache

instead you can do {{^page}}...{{/page}} to have content that only appears on posts

Answered 3 years ago · Improve this answer