{# GALLERY MODULE #} {# GLOBAL VARS #} {% set settings = page.gallery %} {% set items = settings.items|split(',') %} {% set limit = settings.limit %} {% set folder_path = assetspath ~ gallery.file_path|trim(".") ~ '/' %} {% if limit is empty or limit < 1 %}{% set limit = 99999 %}{% endif %} {# Video include #} {% if gallery_videos|length > 0 and 'hide-video' not in settings.classes and 'video-bottom' not in settings.classes %} {% include 'partials/module.video.html' %} {% if gallery_images|length > 0 %}
{% endif %} {% endif %} {# image_noindex rel="nofollow" #} {% set nofollow = page.settings.image_noindex ? ' rel="nofollow"' : '' %} {# set crop ratio if defined #} {% if settings.crop.enabled and settings.layout != "justified" and settings.layout != "columns" %} {% set crop_ratio = settings.crop.crop[1] / settings.crop.crop[0] * 100 %} {% endif %} {# split #} {% set gallery_split_view = settings.split.enabled and settings.layout != "justified" and settings.layout != "columns" %} {% if gallery_split_view %} {# invert #} {% if settings.split.invert %} {% set push = 'medium-push-' ~ (12 - settings.split.ratio) %} {% set pull = 'medium-pull-' ~ settings.split.ratio %} {% endif %} {% endif %} {# grid #} {% if settings.layout == "grid" %} {% if settings.grid.use_width %} {% set block_grid = ['3','2','1'] %} {% else %} {% set block_grid = settings.grid.columns|split(",") %} {% endif %} {% set columns_limit = min(limit, gallery_images|length) %} {% set small_grid = min(block_grid[2]|default(block_grid[1])|default(block_grid[0])|default('1'), columns_limit) %} {% set medium_grid = min(block_grid[1]|default(block_grid[0])|default('2'), columns_limit) %} {% set large_grid = min(block_grid[0]|default('3'), columns_limit) %} {% set ul_open = "' %} {% endif %} {# grid start #} {{ ul_open }} {# START LOOP #} {% for image in gallery_images %} {# Loop only within limit #} {% if loop.index0 < limit %} {# SET ALL ITEM VARS #} {% set url = assetspath ~ (gallery.file_path ~ "/" ~ image.file_name)|trim(".") %} {% set image_link = image.link|default(settings.image.link) %} {% set link_target = image.target|default(settings.image.link_target) %} {% set name_no_ext = image.file_name|removeExtension %} {# Check if image link is set #} {% if image_link %} {% set link_href = image_link|replace({'{file_name}': name_no_ext, '{file_name_ext}': image.file_name, '{path}': folder_path, '{image_path}': folder_path ~ image.file_name, '{{files}}': assetspath ~ '/content/custom/files' }) %} {# auto link target #} {% if link_target is empty or link_target == 'auto' %} {% if link_href|lower starts with 'http' or hasExtension(link_href) %} {% set link_target = ' target=_blank' %} {% else %} {% set link_target = '' %} {% endif %} {# popup target #} {% elseif link_target == 'popup' %} {% set link_target = ' data-popup-window="' ~ image.name|replace({" ": "-"}) ~ ',' ~ settings.image.popup_width ~ ',' ~ settings.image.popup_height ~ '"' %} {# blank target #} {% elseif link_target == '_blank' %} {% set link_target = ' target=_blank' %} {# x3 popup #} {% elseif link_target == 'x3_popup' %} {% set link_target = ' data-popup' %} {# self _self #} {% else %} {% set link_target = '' %} {% endif %} {# normal image popup link #} {% else %} {% set link_href = gallery.permalink|setpath(rootpath) ~ name_no_ext|replace({' ': '_'}) ~ '/' %} {% set link_target = '' %} {% endif %} {# image title #} {% set title = getDefault(image.title, settings.image.title, settings.image.title_include)|striptags('')|replace({'{file_name}': name_no_ext, '{file_name_ext}': image.file_name, '{path}': folder_path, '{image_path}': folder_path ~ image.file_name, '{{files}}': assetspath ~ '/content/custom/files'})|default(image.name) %} {% set title_pseudo = title|replace({'': '', ' href=': ' data-href=', ' target=': ' data-target='}) %} {# image description #} {% set image_description = getDefault(image.description, settings.image.description, settings.image.description_include) %} {% if image_description is empty %} {% set description = '' %} {% set description_pseudo = '' %} {% else %} {% set description = image_description|striptags('