{% extends '@SyliusShop/layout.html.twig' %}
{% set published = (page.publishAt is not null and page.publishAt|date("Y-m-d H:i:s") < "now"|date("Y-m-d H:i:s") or page.publishAt is null) %}
{%- block title -%}
{% if page.title is not empty and published == true %}
{{ page.title }}
{% else %}
{{ parent() }}
{% endif %}
{%- endblock -%}
{% block metatags %}
{% if published == true %}
{% if page.metaKeywords is not empty %}
<meta name="keywords" content="{{ page.metaKeywords }}"/>
{% endif %}
{% if page.metaDescription is not empty %}
<meta name="description" content="{{ page.metaDescription }}"/>
{% endif %}
{% endif %}
{% endblock %}
{% block content %}
{% if published == true %}
<div class="ui breadcrumb">
{% set sectionCode = page.sections.first().code ?? '' %}
{% set homeLink %}
{% if 'blog_posts' in sectionCode %}
{{ path('app_blog') }}
{% elseif 'blog' in sectionCode %}
{{ path('app_tech_knowledge') }}
{% else %}
{{ path('sylius_shop_homepage') }}
{% endif %}
{% endset %}
<a href="{{ path('sylius_shop_homepage') }}" class="section">{{ 'sylius.ui.home'|trans }}</a>
<div class="divider">/</div>
{% if page.sections.first() is not empty %}
<a href="{{ homeLink }}" class="section">{{ page.sections.first().name }}</a>
<div class="divider">/</div>
{% endif %}
<div class="active section">{{ page.name }}</div>
</div>
<div class="ui segment">
<h1 class="ui dividing header bitbag-page-name">{{ page.name }}</h1>
<div class="ui grid center aligned">
<div class="wide column">
{% if page.image %}
<img class="page-image ui fluid image" src="{{ aws_s3_base_url ~ '/media/image' ~ page.image.path }}" alt="">
{% endif %}
</div>
</div>
<div class="bitbag-page-content">{{ bitbag_cms_render_content(page) | prepend_image_base_url }}</div>
{# <div class="ui dividing header"></div> #}
{# <div class="bitbag-page-sections"> #}
{# {% include '@BitBagSyliusCmsPlugin/Shop/Page/Show/_sections.html.twig' %} #}
{# </div> #}
</div>
{% if page.products|length > 0 %}
<h2>
{{ 'bitbag_sylius_cms_plugin.ui.page_related_products'|trans }}
</h2>
<div class="bitbag-page-products" data-js-products-carousel-id="related-products">
{% include '@SyliusShop/Product/_horizontalList.html.twig' with {'products': page.products} %}
</div>
{% endif %}
{% else %}
{% include '@BitBagSyliusCmsPlugin/Shop/Page/Error/_notPublished.html.twig' with {'publishAt': page.publishAt} %}
{% endif %}
{% endblock %}