Developers

Using elements in templates

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Element list example</title>
  </head>

  <body>
    {% addbutton element_type="Element" %}
    <h1>Books</h1>

    {% for book in elements %}
      <div class="book">
        <h2><a href="{{ book.url }}">{{ book.title }}</a></h2>
        <p>{{ book.author }} - {{ book.isbn }}</p>
        <img src="{{ book.cover_photo }}">
      </div>
    {% endfor %}
    {% sitejs_include %}
  </body>
</html>

Types

  • Plain text - in edit view, text field will be displayed
  • Rich text - editable with rich text area in edit view
  • Boolean - in edit view, checkbox will be displayed
  • Image - area to drop image here is being displayed in edit mode
  • Select - displays list of options to select as value