title: Global variables in Handlebars if blocks
body: <p>Is it possibly to use global variables in Handlebars conditionals? I'm writing an app that lists a lot of objects, and I want users to be able to control which details are listed. For example, displaying only first names in a list of people, like so:</p>
  
  <pre><code>&lt;ul&gt;
  {{#each people}}
      &lt;li&gt;
          &lt;p&gt;{{firstName}}&lt;/p&gt;
          {{#if displayLastnames}}
          &lt;p&gt;{{lastName}}&lt;/p&gt;
          {{/if}}
      &lt;/li&gt;
  {{/each}}
  &lt;/ul&gt;
  </code></pre>
  
  <p>I don't want to actually modify the data (for example, by removing the lastName attribute and doing <code>{{#if lastName}}</code>).</p>