{% set locale = sylius.localeCode|default(sylius_base_locale) %}
{% if resource is defined and resource.referenceableContent is defined and resource.referenceableContent is not null %}
{% set donothing = resource.referenceableContent.setCurrentLocale(locale) %}
{% set seo = resource %}
{% endif %}
{% if sylius.channel.referenceableContent is defined and sylius.channel.referenceableContent is not null %}
{% set donothing = sylius.channel.referenceableContent.setCurrentLocale(locale) %}
{% set baseSeo = sylius.channel %}
{% endif %}
{% if seo is defined and seo.metadataTitle %}
{{ seo.metadataTitle }}
{% else %}
{% if getType(resource) == "channel" %}
{{ sylius.channel.name }}
{% elseif getType(resource) == "product" %}
{% if app_get_page_meta_by_code("product",{ 'product': resource }) is not empty %}
{% set meta = app_get_page_meta_by_code("product", { 'product': resource }) %}
{% if meta.title is not null %}
{{ meta.title }}
{% endif %}
{% endif %}
{% endif %}
{% endif %}