{% set gallery_data = load_data(literal = body, format="json") %}

<div id="image-gallery">
  <ul class="gallery">
    {% for item in gallery_data %}
      {% set base_path = page.path | split(pat="/") | slice(end=-1) | join(sep="/") %}
      {% set image_path = base_path ~ "/" ~ item.file %}
      {% set image_url = get_url(path=image_path) %}
      <li class="gallery-item">
        <a href="{{ image_url }}" class="lightbox" target="_blank">
          <img src="{{ image_url }}" {% if item.alt %}alt="{{ item.alt }}"{% endif %}>
        </a>
        {% if item.title %}
          <p class="caption">{{ item.title }}</p>
        {% endif %}
      </li>
    {% endfor %}
  </ul>
</div>
