{% extends '@nucleus/partials/particle.html.twig' %}

{% set attr_extra = particle.extra|attribute_array %}
{% set article_settings = particle.article %}
{% set filter = article_settings.filter %}
{% set sort = article_settings.sort %}
{% set limit = article_settings.limit %}
{% set display = article_settings.display %}

{# Category Finder #}
{% set category_options = filter.categories ? {id: [filter.categories|split(','), 0]} : {} %}
{% set categories = joomla.finder('category', category_options).published(1).language().limit(0).find() %}

{# Content Finder #}
{% if filter.articles %}
    {% set article_options = filter.articles ? {id: [filter.articles|replace({' ': ''})|split(',')]} : {} %}
    {% set article_finder = joomla.finder('content', article_options).published(1).language() %}
{% else %}
    {% set article_finder = joomla.finder('content').category(categories).published(1).language() %}
{% endif %}

{% set featured = filter.featured|default('include') %}
{% if featured == 'exclude' %}
    {% do article_finder.featured(false) %}
{% elseif featured == 'only' %}
    {% do article_finder.featured(true) %}
{% endif %}

{% set start = limit.start + max(0, ajax.start|int) %}
{% do article_finder.order(sort.orderby, sort.ordering).limit(limit.total).start(start) %}
{% set total = article_finder.count() %}
{% set articles = article_finder.find() %}

{% block stylesheets %}
<style>
{% if particle.particle_title_color or particle.particle_title_fontsize %}
#{{ id }}.g5-particle-title { {% if particle.particle_title_color %}color: {{ particle.particle_title_color }};{% endif %}{% if particle.particle_title_fontsize %}font-size: {{particle.particle_title_fontsize}}px;{% endif %} }
{% endif %}
{% if particle.customize_title_color or particle.customize_title_fontsize %}
#{{ id }} .tm-title { {% if particle.customize_title_color %}color: {{particle.customize_title_color}} !important; {% endif %}{% if particle.customize_title_fontsize %}font-size: {{particle.customize_title_fontsize}}px;{% endif %} }
{% endif %}
{% if particle.meta_color or particle.meta_fontsize %}
#{{ id }} .tm-meta li span, #{{ id }} .tm-meta li a { {% if particle.meta_color %}color: {{particle.meta_color}};{% endif %}{% if particle.meta_fontsize %} font-size: {{particle.meta_fontsize}}px;{% endif %}text-transform: uppercase; }
{% endif %}
</style>

{% endblock %}

{# Set Viewport Height #}
{% if particle.viewport_height == 'full' %}
    {% set viewport_height = 'jl-height-viewport="offset-top: true;"' %}
{% elseif particle.viewport_height == 'percent' %}
    {% set viewport_height = 'jl-height-viewport="offset-top: true; offset-bottom: 20;"' %}
{% elseif particle.viewport_height == 'section' %}
    {% set viewport_height = 'jl-height-viewport="offset-top: true; offset-bottom: 50;"' %}
{% elseif particle.viewport_height == 'expand' %}
    {% set viewport_height = 'jl-height-viewport="expand: true;"' %}
{% endif %}

{# Set Max-Width Content Section #}
{% set container_maxwidth = particle.container_maxwidth != 'default' ? 'jl-container jl-container-' ~ particle.container_maxwidth|e ~ '' : 'jl-container' %}

{# Set Title/Meta/Content Text Transform #}
{% set title_text_transform = particle.title_text_transform ? ' jl-text-' ~ particle.title_text_transform|e ~ '' %}
{% set meta_text_transform = particle.meta_text_transform ? ' jl-text-' ~ particle.meta_text_transform|e ~ '' %}

{# Set Padding #}
{% if particle.padding == 'default' %}
    {% set padding = ' jl-section' %}
{% elseif particle.padding == 'none' %}
    {% set padding = ' jl-section jl-padding-remove-vertical' %}
{% else %}
    {% set padding = ' jl-section jl-section-' ~ particle.padding|e ~ '' %}
{% endif %}

{# Set Background color #}
{% set parallax_bg_color = particle.parallax_bg_color ? 'style="background-color: ' ~ particle.parallax_bg_color ~ ';"' %}
{% set parallax_overlay = (particle.parallax_bg_overlay ? '<div class="jl-position-cover" style="background-color: '~ particle.parallax_bg_overlay ~';"></div>') %}
{% set parallax_easing = particle.parallax_easing ? 'easing:' ~ particle.parallax_easing / 10 ~ '' %}

{# Set Max-Width Content #}
{% set content_maxwidth %}
{% if particle.g_maxwidth != 'inherit' %} jl-width-{{particle.g_maxwidth}}{% if particle.g_maxwidth_breakpoint != 'always' %}@{{particle.g_maxwidth_breakpoint}}{% endif %}{% if particle.g_maxwidth_alignment == 'left' %}{% elseif particle.g_maxwidth_alignment == 'center' %} jl-margin-auto{% else %} jl-margin-auto-left{% endif %}{% endif %}
{% endset %}

{# Set Parallax Background #}
{% set parallaxbackground %}
{% if particle.parallax_image %}
<div data-src="{{ url(particle.parallax_image)|e }}" class="jl-background-norepeat{{ particle.parallax_bg_overlay ? ' jl-position-relative' : '' }}{{padding}} jl-background-{{particle.background_image_position|e}}{% if particle.background_image_size != 'auto' %} jl-background-{{particle.background_image_size|e}}{% endif %}{% if particle.parallax_bg_visibility != 'always' %} jl-background-image@{{particle.parallax_bg_visibility|e}}{% endif %}{% if particle.vertical_alignment != 'none' %} jl-flex jl-flex-{{particle.vertical_alignment|e}}{% endif %}{% if particle.parallax_text_color != 'default' %} jl-{{particle.parallax_text_color|e}}{% endif %}{% if particle.blendmode != 'inherit' %} jl-background-blend-{{particle.blendmode|e}}{% endif %}" {{parallax_bg_color|default('')|raw}}{% if particle.horizontal_start or particle.horizontal_end or particle.vertical_start or particle.vertical_end or particle.parallax_easing %} jl-parallax="{% if particle.horizontal_start or particle.horizontal_end %}bgx: {{particle.horizontal_start|e}},{{particle.horizontal_end|e}};{% endif %}{% if particle.vertical_start or particle.vertical_end %}bgy: {{particle.vertical_start|e}},{{particle.vertical_end|e}};{% endif %}{% if particle.parallax_bg_breakpoint != 'always' %} media: @{{particle.parallax_bg_breakpoint|e}};{% endif %}{{parallax_easing}}" {% endif %} jl-img {{viewport_height|raw}}>
{{parallax_overlay|raw}}
{% if particle.container_maxwidth != 'none' %}
<div class="{{container_maxwidth}}">
{% endif %}
{% endif %}
{% endset %}

{# End Parallax Background #}
{% set endparallaxbackground %}
{% if particle.parallax_image %}
{% if particle.container_maxwidth != 'none' %}
</div>
{% endif %}
</div>
{% endif %}
{% endset %}

{# Set Horizontal #}
{% set pahorizontal %}
{% if particle.pa_horizontal_start or particle.pa_horizontal_end %}x: {% if particle.pa_horizontal_start == '' %}0{% else %}{{particle.pa_horizontal_start }}{% endif %},{% if particle.pa_horizontal_end == '' %}0{% else %}{{particle.pa_horizontal_end }}{% endif %};{% endif %}
{% endset %}

{# Set Vertical #}
{% set pavertical %}
{% if particle.pa_vertical_start or particle.pa_vertical_end %}y: {% if particle.pa_vertical_start == '' %}0{% else %}{{particle.pa_vertical_start }}{% endif %},{% if particle.pa_vertical_end == '' %}0{% else %}{{particle.pa_vertical_end }}{% endif %};{% endif %}
{% endset %}

{# Set Scale #}
{% set scale %}
{% if particle.scale_start or particle.scale_end %}scale: {% if particle.scale_start == '' %}1{% else %}{{particle.scale_start / 100 }}{% endif %},{% if particle.scale_end == '' %}1{% else %} {{particle.scale_end / 100 }}{% endif %};{% endif %}
{% endset %}

{# Set Rotate #}
{% set rotate %}{% if particle.rotate_start or particle.rotate_end %}
rotate: {% if particle.rotate_start == '' %}0{% else %}{{particle.rotate_start}}{% endif %},{% if particle.rotate_end == '' %}0{% else %}{{particle.rotate_end}}{% endif %};{% endif %}
{% endset %}

{# Set Opacity #}
{% set opacity %}
{% if particle.opacity_start or particle.opacity_end %}opacity: {% if particle.opacity_start == '' %}1{% else %}{{particle.opacity_start / 100 }}{% endif %},{% if particle.opacity_end == '' %}1{% else %}{{particle.opacity_end / 100 }}{% endif %};{% endif %}
{% endset %}

{# Set Scrollspy Animation #}
{% set scrollspy_cls = particle.animation != 'inherit' and particle.animation != 'parallax' ? ' jl-scrollspy-class' %}

{# Set Animation #}
{% set animation %}
{% if particle.animation != 'inherit' and particle.animation != 'parallax' %} jl-scrollspy="target: [jl-scrollspy-class]; cls: jl-animation-{{particle.animation|e}};{% if particle.animation_repeat == 'enabled' %} repeat: true;{% endif %} delay:{% if particle.delay_element_animations %} {{particle.animation_delay|default('200')|e}};{% else %} false;{% endif %}"
{% elseif particle.animation == 'parallax' %}
{% if particle.pa_horizontal_start or particle.pa_horizontal_end or particle.pa_vertical_start or particle.pa_vertical_end or particle.scale_start or particle.scale_end or particle.rotate_start or particle.rotate_end or particle.opacity_start or particle.opacity_end or particle.easing or particle.pa_viewport or particle.pa_breakpoint %} jl-parallax="{{pahorizontal}}{{pavertical}}{{scale}}{{rotate}}{{opacity}}{% if particle.easing == '' %}{% else %}easing: {{ particle.easing / 100 }};{% endif %}{% if particle.pa_viewport != '' %}viewport:{{ particle.pa_viewport / 100 }};{% endif %}{% if particle.pa_breakpoint != 'always' %}media: @{{particle.pa_breakpoint|e}}{% endif %}"{% endif %}
{% endif %}
{% endset %}

{# Set Particle Alignment #}
{% set particle_alignment %}
{% if particle.align != 'inherit' %} jl-text-{{particle.align|e}}{% if particle.breakpoint != 'always' %}@{{particle.breakpoint|e}}{% endif %}{% endif %}{% if particle.align != 'inherit' and particle.breakpoint != 'always' %}{% if particle.fallback != 'inherit' %} jl-text-{{particle.fallback|e}}{% endif %}{% endif %}
{% endset %}

{# Set Particle Alignment for Subnav style #}
{% set subnav_alignment %}
{% if particle.align != 'inherit' %} jl-flex-{{particle.align|e}}{% if particle.breakpoint != 'always' %}@{{particle.breakpoint|e}}{% endif %}{% endif %}{% if particle.align != 'inherit' and particle.breakpoint != 'always' %}{% if particle.fallback != 'inherit' %} jl-flex-{{particle.fallback|e}}{% endif %}{% endif %}
{% endset %}

{# set Particle Title Style #}
{% set particle_title_style %}
{% if particle.particle_title %}
<{{particle.particle_title_element|e}} id="{{ id }}" class="g5-particle-title{% if particle.particle_predefined_color %} jl-text-{{particle.particle_predefined_color|e}}{% endif %}{% if particle.particle_title_align != 'inherit' %} jl-text-{{particle.particle_title_align|e}}{% endif %}{% if particle.particle_title_style %} jl-{{particle.particle_title_style|e}}{% endif %}{% if particle.particle_title_decoration %} jl-heading-{{particle.particle_title_decoration|e}}{% endif %}">
{% if particle.particle_title_decoration == 'line' %} <span>{{particle.particle_title|raw}}</span>
{% else %} {{particle.particle_title|raw}}
{% endif %}
</{{particle.particle_title_element|e}}>
{% endif %}
{% endset %}

{% if particle.overlay_hover %}
{% set overlay_transition = ' jl-transition-' ~ particle.overlay_transition|e ~ '' %}
{% endif %}

{% set image_transition = particle.image_transition != 'none' ? ' jl-transition-' ~ particle.image_transition|e ~ ' jl-transition-opaque' %}
{% set title_hover = (particle.title_hover ? ' class="jl-link-'~ particle.title_hover ~'"') %}

{% if ( particle.link_overlay or particle.overlay_hover) and particle.image_transition != 'none' %}
{% set link_transition = ' jl-transition-toggle' %}
{% set tab_transition = ' tabindex="0"' %}
{% endif %}
{% set overlay_color = particle.overlay_color != 'default' ? ' jl-' ~ particle.overlay_color|e ~ '' %}
{% set overlay_style = particle.overlay_style != 'none' ? ' ' ~ particle.overlay_style|e ~ '' %}
{% set meta_margin_top = particle.meta_margin_top != 'default' ? ' jl-margin-' ~ particle.meta_margin_top|e ~ '-top' : ' jl-margin-top' %}

{% block particle %}
{% if particle.enabled %}
{{particle_title_style}}

<div id="{{ id }}" class="tiles-style-{{particle.tiles_style}}{% if particle.tiles_style == '4' %} jl-grid-match{% endif %}{% if particle.tiles_style == '5' %} jl-grid-small{% endif %}{{content_maxwidth}}{% if particle.class %} {{ particle.class }}{% endif %}{{particle_alignment}}{% if particle.margin == 'inherit' %}{% elseif particle.margin == 'default' %} jl-margin{% else %} jl-margin-{{particle.margin|e}}{% endif %}{% if particle.visibility != 'inherit' %} jl-visible@{{particle.visibility|e}}{% endif %}{% if particle.tiles_style == 4 %} jl-grid-small{% endif %}"{{animation}} jl-grid>

{% if particle.tiles_style == 1 or particle.tiles_style == 2 %}

<div class="jl-width-expand@m">
{% for article in articles[0:1] %}

{% set article_edit_link %}
{% if display.edit and article.edit %}
    <div class="jl-margin-small"><a class="g-array-item-edit" href="{{ article.edit }}"><i class="fa fa-pencil" aria-hidden="true"></i> {{ 'JGLOBAL_EDIT'|trans }}</a></div>
{% endif %}
{% endset %}

{# Set Meta Content #}
{% set item_meta %}
{% if display.date.enabled or display.author.enabled or display.category.enabled or display.hits.enabled %}
{% if particle.meta_styles == 'list' %}
<ul class="tm-meta{{meta_text_transform}}{{subnav_alignment}} jl-subnav{% if particle.meta_subnav_style != 'default' %} jl-subnav-{{particle.meta_subnav_style|e}}{% endif %}{% if particle.pre_meta_color != 'default' %} jl-text-{{particle.pre_meta_color|e}}{% endif %}{{meta_margin_top}}">
    {% if display.date.enabled %}
    <li class="g-array-item-date">
    <span>
    {% if display.date.enabled == 'published' %}
    {{ article.publish_up|date(display.date.format) }}
    {% elseif display.date.enabled == 'modified' %}
    {{ article.modified|date(display.date.format) }}
    {% else %}
    {{ article.created|date(display.date.format) }}
    {% endif %}
    </span>
    </li>
    {% endif %}

    {% if display.author.enabled %}
    <li class="g-array-item-author"><span class="g-array-item-author">{{ article.author.name }}</span></li>
    {% endif %}

    {% if display.category.enabled %}
    {% set category_link = display.category.enabled == 'link' %}
    <li class="g-array-item-category">
    {% set cat = article.categories|last %}
    {% if category_link and particle.link_overlay == false %}
    <a href="{{ cat.route }}">
    {{ cat.title }}
    </a>
    {% else %}
    <span class="g-array-item-category">{{ cat.title }}</span>
    {% endif %}
    </li>
    {% endif %}

    {% if display.hits.enabled %}
    <li class="g-array-item-hits">
    <span><i class="fa fa-eye" aria-hidden="true"></i>{{ article.hits }}</span>
    </li>
    {% endif %}
</ul>
{% else %}
<p class="tm-meta{{meta_text_transform}}{{meta_margin_top}} jl-margin-remove-bottom jl-article-meta{% if particle.pre_meta_color != 'default' %} jl-text-{{particle.pre_meta_color|e}}{% endif %}">

    {% if display.author.enabled %}
        {{ particle.author_meta|default('Written by')|raw}} {{ article.author.name }}
    {% endif %}

    {% if display.author.enabled and display.date.enabled %}
    {% set meta_date = particle.date_meta|default('on')|raw %}
    {% else %}
    {% set meta_date = particle.date_meta|default('Written on')|raw %}
    {% endif %}

    {% if display.date.enabled %}
        {% if display.date.enabled == 'published' %}
            {{ meta_date }} {{ article.publish_up|date(display.date.format) }}{{ '.'|trim }}
        {% elseif display.date.enabled == 'modified' %}
            {{ meta_date }} {{ article.modified|date(display.date.format) }}{{ '.'|trim }}
        {% else %}
            {{ meta_date }} {{ article.created|date(display.date.format) }}{{ '.'|trim }}
        {% endif %}
    {% endif %}

    {% if display.category.enabled %}
        {% set category_link = display.category.enabled == 'link' %}
        {% set cat = article.categories|last %}
        {% if category_link and particle.link_overlay == false %}
            {{ particle.category_meta|default('Posted in')|raw}} <a href="{{ cat.route }}">{{ cat.title }}</a>
        {% else %}
            {{ particle.category_meta|default('Posted in')|raw}} {{ cat.title }}
        {% endif %}
    {% endif %}

    {% if display.hits.enabled %}
        <span class="g-array-item-hits">
            <i class="fa fa-eye" aria-hidden="true"></i> {{ article.hits }}
        </span>
    {% endif %}

</p>
{% endif %}
{% endif %}
{% endset %}

{% if particle.link_overlay %}
<a class="tm-item jl-inline-clip jl-display-block jl-link-toggle{{link_transition}}" href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}"{{tab_transition|raw}}{{scrollspy_cls}}>
{% else %}
<div class="tm-item jl-inline-clip{{link_transition}}"{{tab_transition|raw}}{{scrollspy_cls}}>
{% endif %}

{% if display.category.enabled and particle.show_label == '1' %}
<div class="jl-position-top-left jl-position-z-index">
{% set category_link = display.category.enabled == 'link' %}
<span class="jl-label">
{% set cat = article.categories|last %}
{% if category_link and particle.link_overlay == false %}
<a class="jl-link-reset" href="{{ cat.route }}">{{ cat.title }}</a>
{% else %}
{{ cat.title }}
{% endif %}
</span>
</div>
{% endif %}

<div class="tm-content-wrapper{{overlay_color}}">

{% if display.image.enabled and article.images.image_intro or article.images.image_fulltext %}
{% if article.images.image_intro and display.image.enabled == 'intro' or display.image.enabled == 'show' %}

<img class="tm-image{{image_transition}}" src="{{ url(article.images.image_intro) }}"{% if article.images.image_intro_alt %} alt="{{article.images.image_intro_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>
{% elseif article.images.image_fulltext and display.image.enabled == 'full' %}
<img class="tm-image{{image_transition}}" src="{{ url(article.images.image_fulltext) }}"{% if article.images.image_fulltext_alt %} alt="{{article.images.image_fulltext_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>
{% endif %}
{% endif %}

<div class="tm-overlay jl-position-cover{{overlay_style}}{{overlay_transition}}"></div>

{% if particle.tiles_style == 1 %}
<div class="jl-overlay{% if particle.overlay_padding != 'default' %} jl-padding-{{ particle.overlay_padding|e }}{% endif %}{% if particle.overlay_position %} jl-position-{{ particle.overlay_position|e }}{% endif %}{% if particle.overlay_margin != 'none' %} jl-position-{{ particle.overlay_margin|e }}{% endif %}{% if particle.overlay_maxwidth != 'none' %} jl-width-{{ particle.overlay_maxwidth|e }}{% endif %} jl-margin-remove-first-child">
{% else %}
<div class="jl-overlay{% if particle.overlay_padding != 'default' %} jl-padding-{{ particle.overlay_padding|e }}{% endif %}{% if particle.overlay_position %} jl-position-{{ particle.overlay_position|e }}{% endif %}{% if particle.overlay_margin != 'none' %} jl-position-{{ particle.overlay_margin|e }}{% endif %}{% if particle.overlay_maxwidth != 'none' %} jl-width-{{ particle.overlay_maxwidth|e }}{% endif %}{% if particle.tiles_style2 %} {{ particle.tiles_style2|e }}{% endif %} jl-margin-remove-first-child">
{% endif %}

{% if particle.meta_alignment == 'top' %}
{{item_meta}}
{% endif %}

{% if display.title.enabled %}
<{{particle.title_element|e}} class="tm-title jl-margin-remove-bottom{{title_text_transform}}{% if particle.title_margin_top == 'default' %} jl-margin-top{% else %} jl-margin-{{ particle.title_margin_top|e }}-top{% endif %}{% if particle.title_color != 'default' %} jl-text-{{particle.title_color|e}}{% endif %}{% if particle.title_style != 'default' %} jl-{{particle.title_style|e}}{% endif %}{% if particle.title_decoration != 'none' %} jl-heading-{{particle.title_decoration|e}}{% endif %}">
    {% if particle.title_decoration == 'line' %}
    <span>
    {% endif %}
    {% if particle.link_title and particle.link_overlay == false %}
    <a{{ title_hover|raw }} href="{{ article.route }}">{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}</a>
    {% else %}
    {{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}
    {% endif %}
    {% if particle.title_decoration == 'line' %}
    </span>
    {% endif %}
</{{particle.title_element|e}}>
{% endif %}

{% if particle.meta_alignment == 'bottom' %}
{{item_meta}}
{% endif %}

</div>

</div>
{% if particle.link_overlay %}
</a>
{% else %}
</div>
{% endif %}

{{article_edit_link}}

{% endfor %}
</div>

<div class="jl-width-expand@l jl-grid-item-match jl-grid-small">

<div class="jl-child-width-1-1 jl-child-width-1-2@m jl-grid-small" jl-grid>

{% for article in articles[1:4] %}

{% set article_edit_link %}
{% if display.edit and article.edit %}
    <div class="jl-margin-small"><a class="g-array-item-edit" href="{{ article.edit }}"><i class="fa fa-pencil" aria-hidden="true"></i> {{ 'JGLOBAL_EDIT'|trans }}</a></div>
{% endif %}
{% endset %}

{# Set Meta Content #}
{% set item_meta %}
{% if display.date.enabled or display.author.enabled or display.category.enabled or display.hits.enabled %}
{% if particle.meta_styles == 'list' %}
<ul class="tm-meta{{meta_text_transform}}{{subnav_alignment}} jl-subnav{% if particle.meta_subnav_style != 'default' %} jl-subnav-{{particle.meta_subnav_style|e}}{% endif %}{% if particle.pre_meta_color != 'default' %} jl-text-{{particle.pre_meta_color|e}}{% endif %}{{meta_margin_top}}">
    {% if display.date.enabled %}
    <li class="g-array-item-date">
    <span>
    {% if display.date.enabled == 'published' %}
    {{ article.publish_up|date(display.date.format) }}
    {% elseif display.date.enabled == 'modified' %}
    {{ article.modified|date(display.date.format) }}
    {% else %}
    {{ article.created|date(display.date.format) }}
    {% endif %}
    </span>
    </li>
    {% endif %}

    {% if display.author.enabled %}
    <li class="g-array-item-author"><span class="g-array-item-author">{{ article.author.name }}</span></li>
    {% endif %}

    {% if display.category.enabled %}
    {% set category_link = display.category.enabled == 'link' %}
    <li class="g-array-item-category">
    {% set cat = article.categories|last %}
    {% if category_link and particle.link_overlay == false %}
    <a href="{{ cat.route }}">
    {{ cat.title }}
    </a>
    {% else %}
    <span class="g-array-item-category">{{ cat.title }}</span>
    {% endif %}
    </li>
    {% endif %}

    {% if display.hits.enabled %}
    <li class="g-array-item-hits">
    <span><i class="fa fa-eye" aria-hidden="true"></i>{{ article.hits }}</span>
    </li>
    {% endif %}
</ul>
{% else %}
<p class="tm-meta{{meta_text_transform}}{{meta_margin_top}} jl-margin-remove-bottom jl-article-meta{% if particle.pre_meta_color != 'default' %} jl-text-{{particle.pre_meta_color|e}}{% endif %}">

    {% if display.author.enabled %}
        {{ particle.author_meta|default('Written by')|raw}} {{ article.author.name }}
    {% endif %}

    {% if display.author.enabled and display.date.enabled %}
    {% set meta_date = particle.date_meta|default('on')|raw %}
    {% else %}
    {% set meta_date = particle.date_meta|default('Written on')|raw %}
    {% endif %}

    {% if display.date.enabled %}
        {% if display.date.enabled == 'published' %}
            {{ meta_date }} {{ article.publish_up|date(display.date.format) }}{{ '.'|trim }}
        {% elseif display.date.enabled == 'modified' %}
            {{ meta_date }} {{ article.modified|date(display.date.format) }}{{ '.'|trim }}
        {% else %}
            {{ meta_date }} {{ article.created|date(display.date.format) }}{{ '.'|trim }}
        {% endif %}
    {% endif %}

    {% if display.category.enabled %}
        {% set category_link = display.category.enabled == 'link' %}
        {% set cat = article.categories|last %}
        {% if category_link and particle.link_overlay == false %}
            {{ particle.category_meta|default('Posted in')|raw}} <a href="{{ cat.route }}">{{ cat.title }}</a>
        {% else %}
            {{ particle.category_meta|default('Posted in')|raw}} {{ cat.title }}
        {% endif %}
    {% endif %}

    {% if display.hits.enabled %}
        <span class="g-array-item-hits">
            <i class="fa fa-eye" aria-hidden="true"></i> {{ article.hits }}
        </span>
    {% endif %}

</p>
{% endif %}
{% endif %}
{% endset %}

<div>

{% if particle.link_overlay %}
<a class="tm-item jl-inline-clip jl-display-block jl-link-toggle{{link_transition}}" href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}"{{tab_transition|raw}}{{scrollspy_cls}}>
{% else %}
<div class="tm-item jl-inline-clip{{link_transition}}"{{tab_transition|raw}}{{scrollspy_cls}}>
{% endif %}

{% if display.category.enabled and particle.show_label == '1' %}
<div class="jl-position-top-left jl-position-z-index">
{% set category_link = display.category.enabled == 'link' %}
<span class="jl-label">
{% set cat = article.categories|last %}
{% if category_link and particle.link_overlay == false %}
<a class="jl-link-reset" href="{{ cat.route }}">{{ cat.title }}</a>
{% else %}
{{ cat.title }}
{% endif %}
</span>
</div>
{% endif %}

<div class="tm-content-wrapper{{overlay_color}}">
{% if display.image.enabled and article.images.image_intro or article.images.image_fulltext %}
{% if article.images.image_intro and display.image.enabled == 'intro' or display.image.enabled == 'show' %}
<img class="tm-image{{image_transition}}" src="{{ url(article.images.image_intro) }}"{% if article.images.image_intro_alt %} alt="{{article.images.image_intro_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>
{% elseif article.images.image_fulltext and display.image.enabled == 'full' %}
<img class="tm-image{{image_transition}}" src="{{ url(article.images.image_fulltext) }}"{% if article.images.image_fulltext_alt %} alt="{{article.images.image_fulltext_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>
{% endif %}
{% endif %}
<div class="jl-position-cover{{overlay_style}}{{overlay_transition}}"></div>

{% if particle.tiles_style == 1 %}
<div class="jl-overlay{% if particle.overlay_padding != 'default' %} jl-padding-{{ particle.overlay_padding|e }}{% endif %}{% if particle.overlay_position %} jl-position-{{ particle.overlay_position|e }}{% endif %}{% if particle.overlay_margin != 'none' %} jl-position-{{ particle.overlay_margin|e }}{% endif %}{% if particle.overlay_maxwidth != 'none' %} jl-width-{{ particle.overlay_maxwidth|e }}{% endif %} jl-margin-remove-first-child">
{% else %}
<div class="jl-overlay{% if particle.overlay_padding != 'default' %} jl-padding-{{ particle.overlay_padding|e }}{% endif %}{% if particle.overlay_position %} jl-position-{{ particle.overlay_position|e }}{% endif %}{% if particle.overlay_margin != 'none' %} jl-position-{{ particle.overlay_margin|e }}{% endif %}{% if particle.overlay_maxwidth != 'none' %} jl-width-{{ particle.overlay_maxwidth|e }}{% endif %}{% if particle.tiles_style2 %} {{ particle.tiles_style2|e }}{% endif %} jl-margin-remove-first-child">
{% endif %}
{% if particle.meta_alignment == 'top' %}
{{item_meta}}
{% endif %}

{% if display.title.enabled %}
<{{particle.title_element|e}} class="tm-title jl-margin-remove-bottom{{title_text_transform}}{% if particle.title_margin_top == 'default' %} jl-margin-top{% else %} jl-margin-{{ particle.title_margin_top|e }}-top{% endif %}{% if particle.title_color != 'default' %} jl-text-{{particle.title_color|e}}{% endif %}{% if particle.title_style != 'default' %} jl-{{particle.title_style|e}}{% endif %}{% if particle.title_decoration != 'none' %} jl-heading-{{particle.title_decoration|e}}{% endif %}">
    {% if particle.title_decoration == 'line' %}
    <span>
    {% endif %}
    {% if particle.link_title and particle.link_overlay == false %}
    <a{{ title_hover|raw }} href="{{ article.route }}">{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}</a>
    {% else %}
    {{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}
    {% endif %}
    {% if particle.title_decoration == 'line' %}
    </span>
    {% endif %}
</{{particle.title_element|e}}>
{% endif %}

{% if particle.meta_alignment == 'bottom' %}
{{item_meta}}
{% endif %}

</div>

</div>

{% if particle.link_overlay %}
</a>
{% else %}
</div>
{% endif %}

{{article_edit_link}}

</div>

{% endfor %}

</div>

</div>

{% elseif particle.tiles_style == 3 %}
{% for article in articles %}

{% set article_edit_link %}
{% if display.edit and article.edit %}
    <div class="jl-margin-small"><a class="g-array-item-edit" href="{{ article.edit }}"><i class="fa fa-pencil" aria-hidden="true"></i> {{ 'JGLOBAL_EDIT'|trans }}</a></div>
{% endif %}
{% endset %}

{# Set Meta Content #}
{% set item_meta %}
{% if display.date.enabled or display.author.enabled or display.category.enabled or display.hits.enabled %}
{% if particle.meta_styles == 'list' %}
<ul class="tm-meta{{meta_text_transform}}{{subnav_alignment}} jl-subnav{% if particle.meta_subnav_style != 'default' %} jl-subnav-{{particle.meta_subnav_style|e}}{% endif %}{% if particle.pre_meta_color != 'default' %} jl-text-{{particle.pre_meta_color|e}}{% endif %}{{meta_margin_top}}">
    {% if display.date.enabled %}
    <li class="g-array-item-date">
    <span>
    {% if display.date.enabled == 'published' %}
    {{ article.publish_up|date(display.date.format) }}
    {% elseif display.date.enabled == 'modified' %}
    {{ article.modified|date(display.date.format) }}
    {% else %}
    {{ article.created|date(display.date.format) }}
    {% endif %}
    </span>
    </li>
    {% endif %}

    {% if display.author.enabled %}
    <li class="g-array-item-author"><span class="g-array-item-author">{{ article.author.name }}</span></li>
    {% endif %}

    {% if display.category.enabled %}
    {% set category_link = display.category.enabled == 'link' %}
    <li class="g-array-item-category">
    {% set cat = article.categories|last %}
    {% if category_link and particle.link_overlay == false %}
    <a href="{{ cat.route }}">
    {{ cat.title }}
    </a>
    {% else %}
    <span class="g-array-item-category">{{ cat.title }}</span>
    {% endif %}
    </li>
    {% endif %}

    {% if display.hits.enabled %}
    <li class="g-array-item-hits">
    <span><i class="fa fa-eye" aria-hidden="true"></i>{{ article.hits }}</span>
    </li>
    {% endif %}
</ul>
{% else %}
<p class="tm-meta{{meta_text_transform}}{{meta_margin_top}} jl-margin-remove-bottom jl-article-meta{% if particle.pre_meta_color != 'default' %} jl-text-{{particle.pre_meta_color|e}}{% endif %}">

    {% if display.author.enabled %}
        {{ particle.author_meta|default('Written by')|raw}} {{ article.author.name }}
    {% endif %}

    {% if display.author.enabled and display.date.enabled %}
    {% set meta_date = particle.date_meta|default('on')|raw %}
    {% else %}
    {% set meta_date = particle.date_meta|default('Written on')|raw %}
    {% endif %}

    {% if display.date.enabled %}
        {% if display.date.enabled == 'published' %}
            {{ meta_date }} {{ article.publish_up|date(display.date.format) }}{{ '.'|trim }}
        {% elseif display.date.enabled == 'modified' %}
            {{ meta_date }} {{ article.modified|date(display.date.format) }}{{ '.'|trim }}
        {% else %}
            {{ meta_date }} {{ article.created|date(display.date.format) }}{{ '.'|trim }}
        {% endif %}
    {% endif %}

    {% if display.category.enabled %}
        {% set category_link = display.category.enabled == 'link' %}
        {% set cat = article.categories|last %}
        {% if category_link and particle.link_overlay == false %}
            {{ particle.category_meta|default('Posted in')|raw}} <a href="{{ cat.route }}">{{ cat.title }}</a>
        {% else %}
            {{ particle.category_meta|default('Posted in')|raw}} {{ cat.title }}
        {% endif %}
    {% endif %}

    {% if display.hits.enabled %}
        <span class="g-array-item-hits">
            <i class="fa fa-eye" aria-hidden="true"></i> {{ article.hits }}
        </span>
    {% endif %}

</p>
{% endif %}
{% endif %}
{% endset %}

<div class="jl-width-1-1@s jl-width-1-2@m jl-width-1-3@l">

{% if particle.link_overlay %}
<a class="tm-item jl-inline-clip jl-display-block jl-link-toggle{{link_transition}}" href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}"{{tab_transition|raw}}{{scrollspy_cls}}>
{% else %}
<div class="tm-item jl-inline-clip{{link_transition}}"{{tab_transition|raw}}{{scrollspy_cls}}>
{% endif %}

{% if display.category.enabled and particle.show_label == '1' %}
    <div class="jl-position-top-left jl-position-z-index">
    {% set category_link = display.category.enabled == 'link' %}
    <span class="jl-label">
    {% set cat = article.categories|last %}
    {% if category_link and particle.link_overlay == false %}
    <a class="jl-link-reset" href="{{ cat.route }}">{{ cat.title }}</a>
    {% else %}
    {{ cat.title }}
    {% endif %}
    </span>
    </div>
{% endif %}

<div class="tm-content-wrapper{{overlay_color}}">

{% if display.image.enabled and article.images.image_intro or article.images.image_fulltext %}
{% if article.images.image_intro and display.image.enabled == 'intro' or display.image.enabled == 'show' %}

<img class="tm-image{{image_transition}}" src="{{ url(article.images.image_intro) }}"{% if article.images.image_intro_alt %} alt="{{article.images.image_intro_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>
{% elseif article.images.image_fulltext and display.image.enabled == 'full' %}
<img class="tm-image{{image_transition}}" src="{{ url(article.images.image_fulltext) }}"{% if article.images.image_fulltext_alt %} alt="{{article.images.image_fulltext_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>
{% endif %}
{% endif %}

<div class="tm-overlay jl-position-cover{{overlay_style}}{{overlay_transition}}"></div>

<div class="jl-overlay{% if particle.overlay_padding != 'default' %} jl-padding-{{ particle.overlay_padding|e }}{% endif %}{% if particle.overlay_position %} jl-position-{{ particle.overlay_position|e }}{% endif %}{% if particle.overlay_margin != 'none' %} jl-position-{{ particle.overlay_margin|e }}{% endif %}{% if particle.overlay_maxwidth != 'none' %} jl-width-{{ particle.overlay_maxwidth|e }}{% endif %}{% if particle.tiles_style2 %} {{ particle.tiles_style2|e }}{% endif %} jl-margin-remove-first-child">

{% if particle.meta_alignment == 'top' %}
{{item_meta}}
{% endif %}

{% if display.title.enabled %}
<{{particle.title_element|e}} class="tm-title jl-margin-remove-bottom{{title_text_transform}}{% if particle.title_margin_top == 'default' %} jl-margin-top{% else %} jl-margin-{{ particle.title_margin_top|e }}-top{% endif %}{% if particle.title_color != 'default' %} jl-text-{{particle.title_color|e}}{% endif %}{% if particle.title_style != 'default' %} jl-{{particle.title_style|e}}{% endif %}{% if particle.title_decoration != 'none' %} jl-heading-{{particle.title_decoration|e}}{% endif %}">
    {% if particle.title_decoration == 'line' %}
    <span>
    {% endif %}
    {% if particle.link_title and particle.link_overlay == false %}
    <a{{ title_hover|raw }} href="{{ article.route }}">{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}</a>
    {% else %}
    {{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}
    {% endif %}
    {% if particle.title_decoration == 'line' %}
    </span>
    {% endif %}
</{{particle.title_element|e}}>
{% endif %}

{% if particle.meta_alignment == 'bottom' %}
{{item_meta}}
{% endif %}

</div>

</div>

{% if particle.link_overlay %}
</a>
{% else %}
</div>
{% endif %}

{{article_edit_link}}

</div>

{% endfor %}

{% elseif particle.tiles_style == 4 %}

<div class="jl-width-expand@l">

{% for article in articles[0:1] %}

{% set article_edit_link %}
{% if display.edit and article.edit %}
    <div class="jl-margin-small"><a class="g-array-item-edit" href="{{ article.edit }}"><i class="fa fa-pencil" aria-hidden="true"></i> {{ 'JGLOBAL_EDIT'|trans }}</a></div>
{% endif %}
{% endset %}

{# Set Meta Content #}
{% set item_meta %}
{% if display.date.enabled or display.author.enabled or display.category.enabled or display.hits.enabled %}
{% if particle.meta_styles == 'list' %}
<ul class="tm-meta{{meta_text_transform}}{{subnav_alignment}} jl-subnav{% if particle.meta_subnav_style != 'default' %} jl-subnav-{{particle.meta_subnav_style|e}}{% endif %}{% if particle.pre_meta_color != 'default' %} jl-text-{{particle.pre_meta_color|e}}{% endif %}{{meta_margin_top}}">
    {% if display.date.enabled %}
    <li class="g-array-item-date">
    <span>
    {% if display.date.enabled == 'published' %}
    {{ article.publish_up|date(display.date.format) }}
    {% elseif display.date.enabled == 'modified' %}
    {{ article.modified|date(display.date.format) }}
    {% else %}
    {{ article.created|date(display.date.format) }}
    {% endif %}
    </span>
    </li>
    {% endif %}

    {% if display.author.enabled %}
    <li class="g-array-item-author"><span class="g-array-item-author">{{ article.author.name }}</span></li>
    {% endif %}

    {% if display.category.enabled %}
    {% set category_link = display.category.enabled == 'link' %}
    <li class="g-array-item-category">
    {% set cat = article.categories|last %}
    {% if category_link and particle.link_overlay == false %}
    <a href="{{ cat.route }}">
    {{ cat.title }}
    </a>
    {% else %}
    <span class="g-array-item-category">{{ cat.title }}</span>
    {% endif %}
    </li>
    {% endif %}

    {% if display.hits.enabled %}
    <li class="g-array-item-hits">
    <span><i class="fa fa-eye" aria-hidden="true"></i>{{ article.hits }}</span>
    </li>
    {% endif %}
</ul>
{% else %}
<p class="tm-meta{{meta_text_transform}}{{meta_margin_top}} jl-margin-remove-bottom jl-article-meta{% if particle.pre_meta_color != 'default' %} jl-text-{{particle.pre_meta_color|e}}{% endif %}">

    {% if display.author.enabled %}
        {{ particle.author_meta|default('Written by')|raw}} {{ article.author.name }}
    {% endif %}

    {% if display.author.enabled and display.date.enabled %}
    {% set meta_date = particle.date_meta|default('on')|raw %}
    {% else %}
    {% set meta_date = particle.date_meta|default('Written on')|raw %}
    {% endif %}

    {% if display.date.enabled %}
        {% if display.date.enabled == 'published' %}
            {{ meta_date }} {{ article.publish_up|date(display.date.format) }}{{ '.'|trim }}
        {% elseif display.date.enabled == 'modified' %}
            {{ meta_date }} {{ article.modified|date(display.date.format) }}{{ '.'|trim }}
        {% else %}
            {{ meta_date }} {{ article.created|date(display.date.format) }}{{ '.'|trim }}
        {% endif %}
    {% endif %}

    {% if display.category.enabled %}
        {% set category_link = display.category.enabled == 'link' %}
        {% set cat = article.categories|last %}
        {% if category_link and particle.link_overlay == false %}
            {{ particle.category_meta|default('Posted in')|raw}} <a href="{{ cat.route }}">{{ cat.title }}</a>
        {% else %}
            {{ particle.category_meta|default('Posted in')|raw}} {{ cat.title }}
        {% endif %}
    {% endif %}

    {% if display.hits.enabled %}
        <span class="g-array-item-hits">
            <i class="fa fa-eye" aria-hidden="true"></i> {{ article.hits }}
        </span>
    {% endif %}

</p>
{% endif %}
{% endif %}
{% endset %}

{% if particle.link_overlay %}
<a class="tm-item jl-inline-clip jl-display-block jl-link-toggle{{overlay_color}}{{link_transition}}" href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}"{{tab_transition|raw}}{{scrollspy_cls}}>
{% else %}
<div class="tm-item jl-inline-clip{{overlay_color}}{{link_transition}}"{{tab_transition|raw}}{{scrollspy_cls}}>
{% endif %}

{% if display.category.enabled and particle.show_label == '1' %}
<div class="jl-position-top-left jl-position-z-index">
{% set category_link = display.category.enabled == 'link' %}
<span class="jl-label">
{% set cat = article.categories|last %}
{% if category_link and particle.link_overlay == false %}
<a class="jl-link-reset" href="{{ cat.route }}">{{ cat.title }}</a>
{% else %}
{{ cat.title }}
{% endif %}
</span>
</div>
{% endif %}

{% if display.image.enabled and article.images.image_intro or article.images.image_fulltext %}
{% if article.images.image_intro and display.image.enabled == 'intro' or display.image.enabled == 'show' %}
{# Style 4: Unset transition and add match height cls #}
<img class="tm-image" src="{{ url(article.images.image_intro) }}"{% if article.images.image_intro_alt %} alt="{{article.images.image_intro_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %} jl-cover>
{% elseif article.images.image_fulltext and display.image.enabled == 'full' %}
<img class="tm-image" src="{{ url(article.images.image_fulltext) }}"{% if article.images.image_fulltext_alt %} alt="{{article.images.image_fulltext_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %} jl-cover>
{% endif %}
{% endif %}

<div class="jl-position-cover{{overlay_style}}{{overlay_transition}} jl-flex jl-flex-center jl-flex-middle">
{% if particle.overlay_hover and particle.overlay_icon %}<span class="jl-icon-button"><i class="fa fa-link " aria-hidden="true"></i></span>{% endif %}
</div>

<div class="jl-overlay{% if particle.overlay_padding != 'default' %} jl-padding-{{ particle.overlay_padding|e }}{% endif %}{% if particle.overlay_position %} jl-position-{{ particle.overlay_position|e }}{% endif %}{% if particle.overlay_margin != 'none' %} jl-position-{{ particle.overlay_margin|e }}{% endif %}{% if particle.overlay_maxwidth != 'none' %} jl-width-{{ particle.overlay_maxwidth|e }}{% endif %}{% if particle.tiles_style2 %} {{ particle.tiles_style2|e }}{% endif %} jl-margin-remove-first-child">

{% if particle.meta_alignment == 'top' %}
{{item_meta}}
{% endif %}

{% if display.title.enabled %}
<{{particle.title_element|e}} class="tm-title jl-margin-remove-bottom{{title_text_transform}}{% if particle.title_margin_top == 'default' %} jl-margin-top{% else %} jl-margin-{{ particle.title_margin_top|e }}-top{% endif %}{% if particle.title_color != 'default' %} jl-text-{{particle.title_color|e}}{% endif %}{% if particle.title_style != 'default' %} jl-{{particle.title_style|e}}{% endif %}{% if particle.title_decoration != 'none' %} jl-heading-{{particle.title_decoration|e}}{% endif %}">
    {% if particle.title_decoration == 'line' %}
    <span>
    {% endif %}
    {% if particle.link_title and particle.link_overlay == false %}
    <a{{ title_hover|raw }} href="{{ article.route }}">{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}</a>
    {% else %}
    {{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}
    {% endif %}
    {% if particle.title_decoration == 'line' %}
    </span>
    {% endif %}
</{{particle.title_element|e}}>
{% endif %}

{% if particle.meta_alignment == 'bottom' %}
{{item_meta}}
{% endif %}

</div>

{% if particle.link_overlay %}
</a>
{% else %}
</div>
{% endif %}

{{article_edit_link}}

{% endfor %}
</div>

<div class="jl-width-expand@l">

{% for article in articles[1:4] %}

{% set article_edit_link %}
{% if display.edit and article.edit %}
    <div class="jl-margin-small"><a class="g-array-item-edit" href="{{ article.edit }}"><i class="fa fa-pencil" aria-hidden="true"></i> {{ 'JGLOBAL_EDIT'|trans }}</a></div>
{% endif %}
{% endset %}

{# Set Meta Content #}
{% set item_meta %}
{% if display.date.enabled or display.author.enabled or display.category.enabled or display.hits.enabled %}
{% if particle.meta_styles == 'list' %}
<ul class="tm-meta{{meta_text_transform}}{{subnav_alignment}} jl-subnav{% if particle.meta_subnav_style != 'default' %} jl-subnav-{{particle.meta_subnav_style|e}}{% endif %}{% if particle.pre_meta_color != 'default' %} jl-text-{{particle.pre_meta_color|e}}{% endif %}{{meta_margin_top}}">
    {% if display.date.enabled %}
    <li class="g-array-item-date">
    <span>
    {% if display.date.enabled == 'published' %}
    {{ article.publish_up|date(display.date.format) }}
    {% elseif display.date.enabled == 'modified' %}
    {{ article.modified|date(display.date.format) }}
    {% else %}
    {{ article.created|date(display.date.format) }}
    {% endif %}
    </span>
    </li>
    {% endif %}

    {% if display.author.enabled %}
    <li class="g-array-item-author"><span class="g-array-item-author">{{ article.author.name }}</span></li>
    {% endif %}

    {% if display.category.enabled %}
    {% set category_link = display.category.enabled == 'link' %}
    <li class="g-array-item-category">
    {% set cat = article.categories|last %}
    {% if category_link and particle.link_overlay == false %}
    <a href="{{ cat.route }}">
    {{ cat.title }}
    </a>
    {% else %}
    <span class="g-array-item-category">{{ cat.title }}</span>
    {% endif %}
    </li>
    {% endif %}

    {% if display.hits.enabled %}
    <li class="g-array-item-hits">
    <span><i class="fa fa-eye" aria-hidden="true"></i>{{ article.hits }}</span>
    </li>
    {% endif %}
</ul>
{% else %}
<p class="tm-meta{{meta_text_transform}}{{meta_margin_top}} jl-margin-remove-bottom jl-article-meta{% if particle.pre_meta_color != 'default' %} jl-text-{{particle.pre_meta_color|e}}{% endif %}">

    {% if display.author.enabled %}
        {{ particle.author_meta|default('Written by')|raw}} {{ article.author.name }}
    {% endif %}

    {% if display.author.enabled and display.date.enabled %}
    {% set meta_date = particle.date_meta|default('on')|raw %}
    {% else %}
    {% set meta_date = particle.date_meta|default('Written on')|raw %}
    {% endif %}

    {% if display.date.enabled %}
        {% if display.date.enabled == 'published' %}
            {{ meta_date }} {{ article.publish_up|date(display.date.format) }}{{ '.'|trim }}
        {% elseif display.date.enabled == 'modified' %}
            {{ meta_date }} {{ article.modified|date(display.date.format) }}{{ '.'|trim }}
        {% else %}
            {{ meta_date }} {{ article.created|date(display.date.format) }}{{ '.'|trim }}
        {% endif %}
    {% endif %}

    {% if display.category.enabled %}
        {% set category_link = display.category.enabled == 'link' %}
        {% set cat = article.categories|last %}
        {% if category_link and particle.link_overlay == false %}
            {{ particle.category_meta|default('Posted in')|raw}} <a href="{{ cat.route }}">{{ cat.title }}</a>
        {% else %}
            {{ particle.category_meta|default('Posted in')|raw}} {{ cat.title }}
        {% endif %}
    {% endif %}

    {% if display.hits.enabled %}
        <span class="g-array-item-hits">
            <i class="fa fa-eye" aria-hidden="true"></i> {{ article.hits }}
        </span>
    {% endif %}

</p>
{% endif %}
{% endif %}
{% endset %}

<div class="jl-child-width-1-1 jl-grid-match jl-grid-small" jl-grid>
<div>

{% if particle.link_overlay %}
<a class="jl-panel jl-margin-remove-first-child jl-display-block jl-link-toggle{{link_transition}}" href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}"{{tab_transition|raw}}{{scrollspy_cls}}>
{% endif %}

<div class="jl-child-width-expand jl-grid-small" jl-grid{{scrollspy_cls}}>
<div class="jl-width-small@m">
        {% if display.image.enabled and article.images.image_intro or article.images.image_fulltext %}
        {% if ( particle.link_overlay or particle.overlay_hover) and particle.image_transition != 'none' %}
        <div class="jl-inline-clip">
        {% endif %}
        {% if article.images.image_intro and display.image.enabled == 'intro' or display.image.enabled == 'show' %}
        <img class="tm-image{{image_transition}}" src="{{ url(article.images.image_intro) }}"{% if article.images.image_intro_alt %} alt="{{article.images.image_intro_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>
        {% elseif article.images.image_fulltext and display.image.enabled == 'full' %}
        <img class="tm-image{{image_transition}}" src="{{ url(article.images.image_fulltext) }}"{% if article.images.image_fulltext_alt %} alt="{{article.images.image_fulltext_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>
        {% endif %}
        {% if ( particle.link_overlay or particle.overlay_hover) and particle.image_transition != 'none' %}
        </div>
        {% endif %}
        {% endif %}
</div>
<div class="tm-content-wrapper{{overlay_color}} jl-margin-remove-first-child">

{% if particle.meta_alignment == 'top' %}
  {{item_meta}}
{% endif %}      

{% if display.title.enabled %}
<{{particle.title_element|e}} class="tm-title jl-margin-remove-bottom{{title_text_transform}}{% if particle.title_margin_top == 'default' %} jl-margin-top{% else %} jl-margin-{{ particle.title_margin_top|e }}-top{% endif %}{% if particle.title_color != 'default' %} jl-text-{{particle.title_color|e}}{% endif %}{% if particle.title_style != 'default' %} jl-{{particle.title_style|e}}{% endif %}{% if particle.title_decoration != 'none' %} jl-heading-{{particle.title_decoration|e}}{% endif %}">
    {% if particle.title_decoration == 'line' %}
    <span>
    {% endif %}
    {% if particle.link_title and particle.link_overlay == false %}
    <a{{ title_hover|raw }} href="{{ article.route }}">{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}</a>
    {% else %}
    {{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}
    {% endif %}
    {% if particle.title_decoration == 'line' %}
    </span>
    {% endif %}
</{{particle.title_element|e}}>
{% endif %}

{% if particle.meta_alignment == 'bottom' %}
{{item_meta}}
{% endif %}      

</div>
</div>

{% if particle.link_overlay %}
</a>
{% endif %}

{{article_edit_link}}

</div>

</div>

{% endfor %}

</div>

{% elseif particle.tiles_style == 5 %}

{% for article in articles %}

{% set article_edit_link %}
{% if display.edit and article.edit %}
    <div class="jl-margin-small"><a class="g-array-item-edit" href="{{ article.edit }}"><i class="fa fa-pencil" aria-hidden="true"></i> {{ 'JGLOBAL_EDIT'|trans }}</a></div>
{% endif %}
{% endset %}

{# Set Meta Content #}
{% set item_meta %}
{% if display.date.enabled or display.author.enabled or display.category.enabled or display.hits.enabled %}
{% if particle.meta_styles == 'list' %}
<ul class="tm-meta{{meta_text_transform}}{{subnav_alignment}} jl-subnav{% if particle.meta_subnav_style != 'default' %} jl-subnav-{{particle.meta_subnav_style|e}}{% endif %}{% if particle.pre_meta_color != 'default' %} jl-text-{{particle.pre_meta_color|e}}{% endif %}{{meta_margin_top}}">
    {% if display.date.enabled %}
    <li class="g-array-item-date">
    <span>
    {% if display.date.enabled == 'published' %}
    {{ article.publish_up|date(display.date.format) }}
    {% elseif display.date.enabled == 'modified' %}
    {{ article.modified|date(display.date.format) }}
    {% else %}
    {{ article.created|date(display.date.format) }}
    {% endif %}
    </span>
    </li>
    {% endif %}

    {% if display.author.enabled %}
    <li class="g-array-item-author"><span class="g-array-item-author">{{ article.author.name }}</span></li>
    {% endif %}

    {% if display.category.enabled %}
    {% set category_link = display.category.enabled == 'link' %}
    <li class="g-array-item-category">
    {% set cat = article.categories|last %}
    {% if category_link and particle.link_overlay == false %}
    <a href="{{ cat.route }}">
    {{ cat.title }}
    </a>
    {% else %}
    <span class="g-array-item-category">{{ cat.title }}</span>
    {% endif %}
    </li>
    {% endif %}

    {% if display.hits.enabled %}
    <li class="g-array-item-hits">
    <span><i class="fa fa-eye" aria-hidden="true"></i>{{ article.hits }}</span>
    </li>
    {% endif %}
</ul>
{% else %}
<p class="tm-meta{{meta_text_transform}}{{meta_margin_top}} jl-margin-remove-bottom jl-article-meta{% if particle.pre_meta_color != 'default' %} jl-text-{{particle.pre_meta_color|e}}{% endif %}">

    {% if display.author.enabled %}
        {{ particle.author_meta|default('Written by')|raw}} {{ article.author.name }}
    {% endif %}

    {% if display.author.enabled and display.date.enabled %}
    {% set meta_date = particle.date_meta|default('on')|raw %}
    {% else %}
    {% set meta_date = particle.date_meta|default('Written on')|raw %}
    {% endif %}

    {% if display.date.enabled %}
        {% if display.date.enabled == 'published' %}
            {{ meta_date }} {{ article.publish_up|date(display.date.format) }}{{ '.'|trim }}
        {% elseif display.date.enabled == 'modified' %}
            {{ meta_date }} {{ article.modified|date(display.date.format) }}{{ '.'|trim }}
        {% else %}
            {{ meta_date }} {{ article.created|date(display.date.format) }}{{ '.'|trim }}
        {% endif %}
    {% endif %}

    {% if display.category.enabled %}
        {% set category_link = display.category.enabled == 'link' %}
        {% set cat = article.categories|last %}
        {% if category_link and particle.link_overlay == false %}
            {{ particle.category_meta|default('Posted in')|raw}} <a href="{{ cat.route }}">{{ cat.title }}</a>
        {% else %}
            {{ particle.category_meta|default('Posted in')|raw}} {{ cat.title }}
        {% endif %}
    {% endif %}

    {% if display.hits.enabled %}
        <span class="g-array-item-hits">
            <i class="fa fa-eye" aria-hidden="true"></i> {{ article.hits }}
        </span>
    {% endif %}

</p>
{% endif %}
{% endif %}
{% endset %}

{% if loop.first %}

<div>

{% if particle.link_overlay %}
<a class="tm-item jl-inline-clip jl-display-block jl-link-toggle{{overlay_color}}{{link_transition}}" href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}"{{tab_transition|raw}}{{scrollspy_cls}}>
{% else %}
<div class="tm-item jl-inline-clip{{overlay_color}}{{link_transition}}"{{tab_transition|raw}}{{scrollspy_cls}}>
{% endif %}

{% if display.category.enabled and particle.show_label == '1' %}
    <div class="jl-position-top-left jl-position-z-index">
    {% set category_link = display.category.enabled == 'link' %}
    <span class="jl-label">
    {% set cat = article.categories|last %}
    {% if category_link and particle.link_overlay == false %}
    <a class="jl-link-reset" href="{{ cat.route }}">{{ cat.title }}</a>
    {% else %}
    {{ cat.title }}
    {% endif %}
    </span>
    </div>
{% endif %}

<div class="tm-content-wrapper{{overlay_color}}">

{% if display.image.enabled and article.images.image_intro or article.images.image_fulltext %}
{% if article.images.image_intro and display.image.enabled == 'intro' or display.image.enabled == 'show' %}

<img class="tm-image{{image_transition}}" src="{{ url(article.images.image_intro) }}"{% if article.images.image_intro_alt %} alt="{{article.images.image_intro_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>
{% elseif article.images.image_fulltext and display.image.enabled == 'full' %}
<img class="tm-image{{image_transition}}" src="{{ url(article.images.image_fulltext) }}"{% if article.images.image_fulltext_alt %} alt="{{article.images.image_fulltext_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>
{% endif %}
{% endif %}

<div class="jl-position-cover{{overlay_style}}{{overlay_transition}} jl-flex jl-flex-center jl-flex-middle">
{% if particle.overlay_hover and particle.overlay_icon %}<span class="jl-icon-button"><i class="fa fa-link " aria-hidden="true"></i></span>{% endif %}
</div>

<div class="jl-overlay{% if particle.overlay_padding != 'default' %} jl-padding-{{ particle.overlay_padding|e }}{% endif %}{% if particle.overlay_position %} jl-position-{{ particle.overlay_position|e }}{% endif %}{% if particle.overlay_margin != 'none' %} jl-position-{{ particle.overlay_margin|e }}{% endif %}{% if particle.overlay_maxwidth != 'none' %} jl-width-{{ particle.overlay_maxwidth|e }}{% endif %}{% if particle.tiles_style2 %} {{ particle.tiles_style2|e }}{% endif %} jl-margin-remove-first-child">

{% if particle.meta_alignment == 'top' %}
{{item_meta}}
{% endif %}

{% if display.title.enabled %}
<{{particle.title_element|e}} class="tm-title jl-margin-remove-bottom{{title_text_transform}}{% if particle.title_margin_top == 'default' %} jl-margin-top{% else %} jl-margin-{{ particle.title_margin_top|e }}-top{% endif %}{% if particle.title_color != 'default' %} jl-text-{{particle.title_color|e}}{% endif %}{% if particle.title_style != 'default' %} jl-{{particle.title_style|e}}{% endif %}{% if particle.title_decoration != 'none' %} jl-heading-{{particle.title_decoration|e}}{% endif %}">
    {% if particle.title_decoration == 'line' %}
    <span>
    {% endif %}
    {% if particle.link_title and particle.link_overlay == false %}
    <a{{ title_hover|raw }} href="{{ article.route }}">{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}</a>
    {% else %}
    {{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}
    {% endif %}
    {% if particle.title_decoration == 'line' %}
    </span>
    {% endif %}
</{{particle.title_element|e}}>
{% endif %}

{% if particle.meta_alignment == 'bottom' %}
{{item_meta}}
{% endif %}

</div>

</div>

{% if particle.link_overlay %}
</a>
{% else %}
</div>
{% endif %}

{{article_edit_link}}

</div>

{% endif %}

{% if not loop.first %}
<div>
<div class="jl-child-width-1-1 jl-grid-match" jl-grid>
<div>

{% if particle.link_overlay %}
<a class="jl-panel jl-margin-remove-first-child jl-display-block jl-link-toggle{{link_transition}}" href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}"{{tab_transition|raw}}{{scrollspy_cls}}>
{% endif %}

<div class="jl-child-width-expand jl-grid-small" jl-grid{{scrollspy_cls}}>

<div class="jl-width-small@m">
    {% if display.image.enabled and article.images.image_intro or article.images.image_fulltext %}
    {% if ( particle.link_overlay or particle.overlay_hover) and particle.image_transition != 'none' %}
    <div class="jl-inline-clip">
    {% endif %}

    {% if article.images.image_intro and display.image.enabled == 'intro' or display.image.enabled == 'show' %}
    <img class="tm-image{{image_transition}}" src="{{ url(article.images.image_intro) }}"{% if article.images.image_intro_alt %} alt="{{article.images.image_intro_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>
    {% elseif article.images.image_fulltext and display.image.enabled == 'full' %}
    <img class="tm-image{{image_transition}}" src="{{ url(article.images.image_fulltext) }}"{% if article.images.image_fulltext_alt %} alt="{{article.images.image_fulltext_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>
    {% endif %}
    {% if ( particle.link_overlay or particle.overlay_hover) and particle.image_transition != 'none' %}
    </div>
    {% endif %}
    {% endif %}

</div>

<div class="tm-content-wrapper{{overlay_color}} jl-margin-remove-first-child">

    {% if particle.meta_alignment == 'top' %}
        {{item_meta}}
    {% endif %}

    {% if display.title.enabled %}
    <{{particle.title_element|e}} class="tm-title jl-margin-remove-bottom{{title_text_transform}}{% if particle.title_margin_top == 'default' %} jl-margin-top{% else %} jl-margin-{{ particle.title_margin_top|e }}-top{% endif %}{% if particle.title_color != 'default' %} jl-text-{{particle.title_color|e}}{% endif %}{% if particle.title_style != 'default' %} jl-{{particle.title_style|e}}{% endif %}{% if particle.title_decoration != 'none' %} jl-heading-{{particle.title_decoration|e}}{% endif %}">
        {% if particle.title_decoration == 'line' %}
        <span>
        {% endif %}
        {% if particle.link_title and particle.link_overlay == false %}
        <a{{ title_hover|raw }} href="{{ article.route }}">{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}</a>
        {% else %}
        {{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}
        {% endif %}
        {% if particle.title_decoration == 'line' %}
        </span>
        {% endif %}
    </{{particle.title_element|e}}>
    {% endif %}

    {% if particle.meta_alignment == 'bottom' %}
        {{item_meta}}
    {% endif %}

</div>

</div>

{% if particle.link_overlay %}
</a>
{% endif %}

{{article_edit_link}}

</div>
</div>
</div>
{% endif %}

{% endfor %}

{% endif %}

</div>
{% endif %}
{% endblock %}