vendor/shopware/storefront/Resources/views/storefront/layout/meta.html.twig line 1

  1. {% block layout_head_inner %}
  2.     {% set metaInformation = page.metaInformation %}
  3.     {% set basicConfig = config('core.basicInformation') %}
  4.     {% set maxLength = config('seo.descriptionMaxLength') %}
  5.     {% set metaDescription = metaInformation.metaDescription|striptags|trim|u.truncate(maxLength ?? 255, '…') %}
  6.     {% set metaTitle = metaInformation.metaTitle|striptags|trim %}
  7.     {% set metaKeywords = metaInformation.metaKeywords|striptags|trim %}
  8.     <head>
  9.         {% block layout_head_meta_tags %}
  10.             {% block layout_head_meta_tags_charset %}
  11.                 <meta charset="utf-8">
  12.             {% endblock %}
  13.             {% block layout_head_meta_tags_viewport %}
  14.                 <meta name="viewport"
  15.                       content="width=device-width, initial-scale=1, shrink-to-fit=no">
  16.             {% endblock %}
  17.             {% block layout_head_meta_tags_general %}
  18.                 <meta name="author"
  19.                       content="{% block layout_head_meta_tags_general_author %}{{ metaInformation.author|striptags }}{% endblock %}"/>
  20.                 <meta name="robots"
  21.                       content="{% block layout_head_meta_tags_robots %}{{ metaInformation.robots }}{% endblock %}"/>
  22.                 <meta name="revisit-after"
  23.                       content="{% block layout_head_meta_tags_general_revisit %}{{ metaInformation.revisit|striptags }}{% endblock %}"/>
  24.                 <meta name="keywords"
  25.                       content="{% block layout_head_meta_tags_keywords %}{{ metaKeywords }}{% endblock %}"/>
  26.                 <meta name="description"
  27.                       content="{% block layout_head_meta_tags_description %}{{ metaDescription }}{% endblock %}"/>
  28.             {% endblock %}
  29.             {% block layout_head_meta_tags_opengraph %}
  30.                 <meta property="og:url"
  31.                       content="{% block layout_head_meta_tags_url_og %}{{ (page.metaInformation.canonical is defined) ? page.metaInformation.canonical : app.request.uri }}{% endblock %}"/>
  32.                 <meta property="og:type"
  33.                       content="{% block layout_head_meta_tags_type_og %}website{% endblock %}"/>
  34.                 <meta property="og:site_name"
  35.                       content="{% block layout_head_meta_tags_sitename_og %}{{ basicConfig.shopName }}{% endblock %}"/>
  36.                 <meta property="og:title"
  37.                       content="{% block layout_head_meta_tags_title_og %}{{ metaTitle }}{% endblock %}"/>
  38.                 <meta property="og:description"
  39.                       content="{% block layout_head_meta_tags_description_og %}{{ metaDescription }}{% endblock %}"/>
  40.                 <meta property="og:image"
  41.                       content="{% block layout_head_meta_tags_image_og %}{{ theme_config('sw-logo-desktop') }}{% endblock %}"/>
  42.                 <meta name="twitter:card"
  43.                       content="{% block layout_head_meta_tags_card_twitter %}summary{% endblock %}"/>
  44.                 <meta name="twitter:site"
  45.                       content="{% block layout_head_meta_tags_sitename_twitter %}{{ basicConfig.shopName }}{% endblock %}"/>
  46.                 <meta name="twitter:title"
  47.                       content="{% block layout_head_meta_tags_title_twitter %}{{ metaTitle }}{% endblock %}"/>
  48.                 <meta name="twitter:description"
  49.                       content="{% block layout_head_meta_tags_description_twitter %}{{ metaDescription }}{% endblock %}"/>
  50.                 <meta name="twitter:image"
  51.                       content="{% block layout_head_meta_tags_image_twitter %}{{ theme_config('sw-logo-desktop') }}{% endblock %}"/>
  52.             {% endblock %}
  53.             {% block layout_head_meta_tags_schema_webpage %}
  54.                 <meta itemprop="copyrightHolder"
  55.                       content="{% block layout_head_meta_tags_copyright_holder %}{{ basicConfig.shopName }}{% endblock %}"/>
  56.                 <meta itemprop="copyrightYear"
  57.                       content="{% block layout_head_meta_tags_copyright_year %}{{ metaInformation.copyrightYear|striptags }}{% endblock %}"/>
  58.                 <meta itemprop="isFamilyFriendly"
  59.                       content="{% block layout_head_meta_tags_family_friendly %}{% if basicConfig.familyFriendly %}true{% else %}false{% endif %}{% endblock %}"/>
  60.                 <meta itemprop="image"
  61.                       content="{% block layout_head_meta_tags_image_meta %}{{ theme_config('sw-logo-desktop') }}{% endblock %}"/>
  62.             {% endblock %}
  63.             {% block layout_head_meta_tags_hreflangs %}
  64.                 {% for link in hrefLang %}
  65.                     <link rel="alternate" hreflang="{{ link.locale }}" href="{{ link.url }}" />
  66.                 {% endfor %}
  67.             {% endblock %}
  68.         {% endblock %}
  69.         {% block layout_head_favicon %}
  70.             <link rel="shortcut icon"
  71.                   href="{{ theme_config('sw-logo-favicon') }}">
  72.         {% endblock %}
  73.         {% block layout_head_apple %}
  74.             {% if theme_config('sw-logo-share') %}
  75.             <link rel="apple-touch-icon"
  76.                   sizes="180x180"
  77.                   href="{{ theme_config('sw-logo-share') }}">
  78.             {% endif %}
  79.         {% endblock %}
  80.         {% block layout_head_canonical %}
  81.             {% if page.metaInformation.canonical %}
  82.                 <link rel="canonical" href="{{ page.metaInformation.canonical }}" />
  83.             {% endif %}
  84.         {% endblock %}
  85.         {% block layout_head_title %}
  86.             <title itemprop="name">{% apply spaceless %}
  87.                 {% block layout_head_title_inner %}
  88.                     {{ metaTitle }}
  89.                 {% endblock %}
  90.             {% endapply %}</title>
  91.         {% endblock %}
  92.         {% block layout_head_stylesheet %}
  93.             {% if isHMRMode %}
  94.                 {# CSS will be loaded from the JS automatically #}
  95.             {% else %}
  96.                 {% set assets = theme_config('assets.css') %}
  97.                 {% for file in assets %}
  98.                     <link rel="stylesheet"
  99.                       href="{{ asset(file, 'theme') }}">
  100.                 {% endfor %}
  101.             {% endif %}
  102.         {% endblock %}
  103.         {% block layout_head_javascript_feature %}
  104.             {% sw_include "@Storefront/storefront/component/feature.html.twig" %}
  105.         {% endblock %}
  106.         {# Block for tracking scripts which are required to include in the `head` section of the document #}
  107.         {% block layout_head_javascript_tracking %}
  108.             {% sw_include "@Storefront/storefront/component/analytics.html.twig" %}
  109.         {% endblock %}
  110.         {% block layout_head_javascript_recaptcha %}
  111.             {% sw_include "@Storefront/storefront/component/recaptcha.html.twig" %}
  112.         {% endblock %}
  113.         {% block layout_head_javascript_token %}
  114.         {% endblock %}
  115.         {% if config('core.basicInformation.useDefaultCookieConsent') %}
  116.             {% block layout_head_javascript_cookie_state %}
  117.                 <script>
  118.                     window.useDefaultCookieConsent = true;
  119.                 </script>
  120.             {% endblock %}
  121.         {% endif %}
  122.         {% block layout_head_javascript_router %}
  123.             {# Register all routes that will be needed in JavaScript to the window.router object #}
  124.             <script>
  125.                 window.activeNavigationId = '{{ page.header.navigation.active.id }}';
  126.                 window.router = {
  127.                     'frontend.cart.offcanvas': '{{ path('frontend.cart.offcanvas') }}',
  128.                     'frontend.cookie.offcanvas': '{{ path('frontend.cookie.offcanvas') }}',
  129.                     'frontend.checkout.finish.page': '{{ path('frontend.checkout.finish.page') }}',
  130.                     'frontend.checkout.info': '{{ path('frontend.checkout.info') }}',
  131.                     'frontend.menu.offcanvas': '{{ path('frontend.menu.offcanvas') }}',
  132.                     'frontend.cms.page': '{{ path('frontend.cms.page') }}',
  133.                     'frontend.cms.navigation.page': '{{ path('frontend.cms.navigation.page') }}',
  134.                     'frontend.account.addressbook': '{{ path('frontend.account.addressbook') }}',
  135.                     'frontend.country.country-data': '{{ path('frontend.country.country.data') }}',
  136.                     };
  137.                 window.salesChannelId = '{{ app.request.attributes.get('sw-sales-channel-id') }}';
  138.             </script>
  139.         {% endblock %}
  140.         {% block layout_head_javascript_breakpoints %}
  141.             {# Register the available viewport breakpoints the window.breakpoints object #}
  142.             <script>
  143.                 {% set breakpoint = {
  144.                     'xs': theme_config('breakpoint.xs'),
  145.                     'sm': theme_config('breakpoint.sm'),
  146.                     'md': theme_config('breakpoint.md'),
  147.                     'lg': theme_config('breakpoint.lg'),
  148.                     'xl': theme_config('breakpoint.xl')
  149.                 } %}
  150.                 window.breakpoints = {{ breakpoint|json_encode()|raw }};
  151.             </script>
  152.         {% endblock %}
  153.         {% if config('core.cart.wishlistEnabled') %}
  154.             {% block layout_head_javascript_wishlist_state %}
  155.                 <script>
  156.                     window.customerLoggedInState = {{ context.customer is not null and not context.customer.guest ? 1 : 0 }};
  157.                     window.wishlistEnabled = {{ config('core.cart.wishlistEnabled') }};
  158.                 </script>
  159.             {% endblock %}
  160.         {% endif %}
  161.         {# jQuery is removed from the default Storefront since tag:v6.5.0 - This block should be used to add jQuery as a `<script>` if needed. #}
  162.         {% block layout_head_javascript_jquery %}
  163.         {% endblock %}
  164.         {% block layout_head_javascript_hmr_mode %}
  165.             {% if isHMRMode %}
  166.                 <script type="text/javascript" src="/_webpack_hot_proxy_/js/vendor-node.js" defer></script>
  167.                 <script type="text/javascript" src="/_webpack_hot_proxy_/js/vendor-shared.js" defer></script>
  168.                 <script type="text/javascript" src="/_webpack_hot_proxy_/js/runtime.js" defer></script>
  169.                 <script type="text/javascript" src="/_webpack_hot_proxy_/js/app.js" defer></script>
  170.                 {# The storefront entry is a combined entry point which contains all plugins & themes #}
  171.                 <script type="text/javascript" src="/_webpack_hot_proxy_/js/storefront.js" defer></script>
  172.             {% else %}
  173.                 {% for file in theme_config('assets.js') %}
  174.                     <script type="text/javascript" src="{{ asset(file, 'theme') }}" defer></script>
  175.                 {% endfor %}
  176.             {% endif %}
  177.         {% endblock %}
  178.     </head>
  179. {% endblock %}