--- regenerate: false --- {% capture j1_cache %} {% comment %} # ----------------------------------------------------------------------------- # ~/assets/data/galleries.json # Liquid JSON template for ALL Justified Galleries configured # # Product/Info: # http://jekyll.one # # Copyright (C) 2019 Juergen Adams # # J1 Template is licensed under the MIT License. # See: https://github.com/jekyll-one/j1_template_mde/blob/master/LICENSE # # ----------------------------------------------------------------------------- # # The Liquid template galleries.json is used by J1 Justified Gallery. # This template is a helper that creates the gallery (JSON) data # for all galleries configured (if enabled or NOT). It's used by # the J1 Template Adapter to LOAD the gallery HTML markup portion # via AJAX get. # # The Liquid template engine generates a JSON file as an object of # arrays that contains all image data used by several sliders. See # below the fields taken from the YAML data file: # ~/_data/modules/j1_justified_gallery.yml. # # NOTE: # Be careful changing the Liquid code. If the code is changed, check # the integrity of the JSON data created. Corrupted JSON data makes # the Javascript of an Adapter to fail and no functionality will # be available for most UNCLEAR reasons. # # ----------------------------------------------------------------------------- # Test data: # {{ liquid_var | debug }} # ----------------------------------------------------------------------------- {% endcomment %} {% assign jg_config = site.data.apps.j1_justified_gallery %} {% assign bg_config = site.data.apps.j1_bootstrap_gallery %} { {% for item in jg_config.galleries %} "{{ item.gallery.id }}" : [ {% if item.gallery.type == "image"%} {% for image in item.gallery.images %} {% assign image_no = forloop.index %} {% capture image_full_path %}{{ item.gallery.images_path }}/{{ image }}{% endcapture %} { {% if item.gallery.captions_lightbox %} {% for caption in item.gallery.captions_lightbox %} {% if forloop.index == image_no %} "captions_lightbox": "{{ caption }}", {% endif %} {% endfor %} {% endif %} {% if item.gallery.captions_gallery %} {% for caption in item.gallery.captions_gallery %} {% if forloop.index == image_no %} "captions_gallery": "{{ caption }}", {% endif %} {% endfor %} {% endif %} "img": "{{ image_full_path }}" }{% if forloop.last %}{% else %},{% endif %} {% endfor %} {% endif %} ], {% endfor %} {% for item in bg_config.galleries %} "{{ item.gallery.id }}" : [ {% if item.gallery.type == "image"%} {% for image in item.gallery.images %} {% assign image_no = forloop.index %} {% capture image_full_path %}{{ item.gallery.images_path }}/{{ image }}{% endcapture %} { {% if item.gallery.captions_lightbox %} {% for caption in item.gallery.captions_lightbox %} {% if forloop.index == image_no %} "captions_lightbox": "{{ caption }}", {% endif %} {% endfor %} {% endif %} {% if item.gallery.captions_gallery %} {% for caption in item.gallery.captions_gallery %} {% if forloop.index == image_no %} "captions_gallery": "{{ caption }}", {% endif %} {% endfor %} {% endif %} "img": "{{ image_full_path }}" }{% if forloop.last %}{% else %},{% endif %} {% endfor %} {% endif %} {% if item.gallery.type == "video-html5" or item.gallery.type == "video-online"%} {% for video in item.gallery.videos %} {% assign image_no = forloop.index %} { {% if item.gallery.type == "video-html5" %} "video_path": "{{ item.gallery.video_path }}", "video_id": "{{ video | slugify }}", {% endif %} "image_path": "{{ item.gallery.image_path }}", {% for poster in item.gallery.poster %} {% if forloop.index == image_no %} "poster": "{{ poster }}", {% endif %} {% endfor %} "video": "{{ video }}", {% if item.gallery.captions_lightbox %} {% for caption in item.gallery.captions_lightbox %} {% if forloop.index == image_no %} "captions_lightbox": "{{ caption }}", {% endif %} {% endfor %} {% endif %} {% if item.gallery.captions_gallery %} {% for caption in item.gallery.captions_gallery %} {% if forloop.index == image_no %} "captions_gallery": "{{ caption }}" {% endif %} {% endfor %} {% endif %} }{% if forloop.last %}{% else %},{% endif %} {% endfor %} {% endif %} ]{% if forloop.last %}{% else %},{% endif %} {% endfor %} } {% endcapture %} {{ j1_cache | strip_empty_lines }} {% assign j1_cache = nil %}