> ## Documentation Index
> Fetch the complete documentation index at: https://docs.doczilla.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Templating with Handlebars

> Minimal templating on steroids.

[Handlebars](https://handlebarsjs.com/) is a simple templating language that enables the efficient separation of logic and layout in a web application. It allows developers to create dynamic HTML by embedding expressions in their HTML templates. These expressions are evaluated at runtime, enabling the generation of HTML with dynamic content.

### Key Features

1. **Logic-less Simplicity**: Handlebars enforces a clear separation of concerns, promoting long-term maintainability of your code.
2. **Dynamic Content Rendering**: Embed values, iterate over data, and even conditionally display blocks of HTML dynamically.
3. **Custom Helpers & Partials**: Define reusable template logic or extend capabilities using custom helpers—no spaghetti templates here!
4. **Support for Internationalization**: With built-in tools like partial blocks and helpers, creating multilingual templates (e.g., PDFs, reports) becomes much simpler.

## Example

<CodeGroup>
  ```handlebars HTML Template theme={null}
  <div>
    <h1>{{title}}</h1>
    <ul>
      {{#each items}}
        <li>{{this}}</li>
      {{/each}}
    </ul>
  </div>
  ```

  ```json Variables theme={null}
  {
    "page": {
      "htmlTemplateData": {
        "title": "Doczilla with Handlebars!",
        "items": ["Item 1", "Item 2", "Item 3"]
      }
    }
  }
  ```
</CodeGroup>

## Output

<CodeGroup>
  ```html HTML theme={null}
  <div>
    <h1>Doczilla with Handlebars!</h1>
    <ul>
      <li>Item 1</li>
      <li>Item 2</li>
      <li>Item 3</li>
    </ul>
  </div>
  ```
</CodeGroup>

## Conclusion

Handlebars is a powerful tool for creating dynamic content in Doczilla, ensuring cleaner code and better separation of concerns in your code.
