Skip to main content Link Search Menu Expand Document (external link)

Handlebars Helpers Reference

Handlebars-style block helpers for control flow and context management in Scryber templates.


On this page

Overview

Handlebars helpers provide familiar syntax for common template patterns like iteration, conditionals, and context switching. They compile to native Scryber XML elements at parse time.


Block Helpers

These helpers use {{#helper}}...{{/helper}} syntax to wrap content.

Helper Description Special Variables
Iterate over arrays and collections @index, @first, @last
Switch data context to a specific object this, ../
Conditional rendering based on expressions -

Branch Helpers

These helpers work within block helpers to create conditional branches.

Helper Description Used With
Alternative condition branch {{#if}}
Fallback branch when conditions are false {{#if}}, {{#each}}, {{#with}}

Utility Helpers

Helper Description Usage
Debug output to console/trace {{log model.value level="debug"}}

Common Patterns

Iteration with Conditionals


  <div class="item ">
    
      <span class="active"></span>
    
      <span class="inactive"></span>
    
  </div>

Context Switching with Parent Access


  <h2>Order #</h2>

  
    <div> - Order #</div>
  

Multiple Conditions


  <span class="grade-a">Excellent</span>

  <span class="grade-b">Good</span>

  <span class="grade-c">Average</span>

  <span class="grade-f">Needs Improvement</span>


See Also