BentoBox

The BentoBox2 Developer Hub

Welcome to the BentoBox2 developer hub. You'll find comprehensive guides and documentation to help you start working with BentoBox2 as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Developer Documentation

Template Basics

BentoBox uses the Jinja2 templating language.

Each file in the /templates/ directory will be visible in the Pages/Nav section of the BentoBox administrator's panel when adding a new page to a Nav.

Each html Template file should (but not required) have a corresponding .json file in the /config/ directory.

Templates in /templates/boxes/ are used to render Boxes with a corresponding configuration file in /config/boxes/. For instance, /templates/boxes/blog.html would be used to render each blog post, as defined in /config/boxes/blog.json

Variables can be accessed in templates by referencing their names with double mustaches. For instance, to display a restaurant's name in a heading tag:

<h1>{{ account.name }}</h1>

Loops, conditionals, and much more are available using syntax similar to many modern programming languages. Take a look:

{% if boxes.menus.all|length > 0 %}
  <h2>Menus</h2>
  <nav>
    {% for menu in boxes.menus.all %}
      <a href="{{ menu.url }}">{{ menu.name }}</a>
    {% endfor %}
  </nav>
{% endif %}

Show me the variables

You can view all of the variables accessible to a template by appending ?help to any URL of a site on BentoBox. Try it on a demo site.

Variables are available by adding `?help` to any Bentobox site URL.

Variables are available by adding ?help to any Bentobox site URL.

For information on these control structures and more refer to Jinja2's documentation.

Template Basics