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

Open in your IDE?
  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_android %}
  81. {# @deprecated tag:v6.5.0 - Use the block above, "layout_head_apple", instead #}
  82. {% endblock %}
  83. {% block layout_head_canonical %}
  84. {% if page.metaInformation.canonical %}
  85. <link rel="canonical" href="{{ page.metaInformation.canonical }}" />
  86. {% endif %}
  87. {% endblock %}
  88. {% block layout_head_title %}
  89. <title itemprop="name">{% apply spaceless %}
  90. {% block layout_head_title_inner %}
  91. {{ metaTitle }}
  92. {% endblock %}
  93. {% endapply %}</title>
  94. {% endblock %}
  95. {% block layout_head_stylesheet %}
  96. {% if isHMRMode %}
  97. {# CSS will be loaded from the JS automatically #}
  98. {% else %}
  99. {% set assets = theme_config('assets.css') %}
  100. {% for file in assets %}
  101. <link rel="stylesheet"
  102. href="{{ asset(file, 'theme') }}">
  103. {% endfor %}
  104. {% endif %}
  105. {% endblock %}
  106. {% block layout_head_javascript_feature %}
  107. {% sw_include "@Storefront/storefront/component/feature.html.twig" %}
  108. {% endblock %}
  109. {# Block for tracking scripts which are required to include in the `head` section of the document #}
  110. {% block layout_head_javascript_tracking %}
  111. {% sw_include "@Storefront/storefront/component/analytics.html.twig" %}
  112. {% endblock %}
  113. {% block layout_head_javascript_recaptcha %}
  114. {% sw_include "@Storefront/storefront/component/recaptcha.html.twig" %}
  115. {% endblock %}
  116. {% block layout_head_javascript_token %}
  117. {% endblock %}
  118. {% if config('core.basicInformation.useDefaultCookieConsent') %}
  119. {% block layout_head_javascript_cookie_state %}
  120. <script>
  121. window.useDefaultCookieConsent = true;
  122. </script>
  123. {% endblock %}
  124. {% endif %}
  125. {% if feature('FEATURE_NEXT_15917') %}
  126. {% block layout_head_javascript_router %}
  127. {# Register all routes that will be needed in JavaScript to the window.router object #}
  128. <script>
  129. window.activeNavigationId = '{{ page.header.navigation.active.id }}';
  130. window.router = {
  131. 'frontend.cart.offcanvas': '{{ path('frontend.cart.offcanvas') }}',
  132. 'frontend.cookie.offcanvas': '{{ path('frontend.cookie.offcanvas') }}',
  133. 'frontend.checkout.finish.page': '{{ path('frontend.checkout.finish.page') }}',
  134. 'frontend.checkout.info': '{{ path('frontend.checkout.info') }}',
  135. 'frontend.menu.offcanvas': '{{ path('frontend.menu.offcanvas') }}',
  136. 'frontend.cms.page': '{{ path('frontend.cms.page') }}',
  137. 'frontend.cms.navigation.page': '{{ path('frontend.cms.navigation.page') }}',
  138. 'frontend.account.addressbook': '{{ path('frontend.account.addressbook') }}',
  139. {# @deprecated tag:v6.5.0 - Route frontend.csrf.generateToken will be removed. #}
  140. 'frontend.csrf.generateToken': '{{ path('frontend.csrf.generateToken') }}',
  141. 'frontend.country.country-data': '{{ path('frontend.country.country.data') }}',
  142. 'frontend.store-api.proxy': '{{ path('frontend.store-api.proxy') }}',
  143. };
  144. {# @deprecated tag:v6.5.0 - storeApiProxyToken will be removed. #}
  145. window.storeApiProxyToken = '{{ sw_csrf("frontend.store-api.proxy", {"mode": "token"}) }}';
  146. window.salesChannelId = '{{ app.request.attributes.get('sw-sales-channel-id') }}';
  147. </script>
  148. {% endblock %}
  149. {% block layout_head_javascript_breakpoints %}
  150. {# Register the available viewport breakpoints the window.breakpoints object #}
  151. <script>
  152. {% set breakpoint = {
  153. 'xs': theme_config('breakpoint.xs'),
  154. 'sm': theme_config('breakpoint.sm'),
  155. 'md': theme_config('breakpoint.md'),
  156. 'lg': theme_config('breakpoint.lg'),
  157. 'xl': theme_config('breakpoint.xl')
  158. } %}
  159. window.breakpoints = {{ breakpoint|json_encode()|raw }};
  160. </script>
  161. {% endblock %}
  162. {# @deprecated tag:v6.5.0 - Block layout_head_javascript_csrf will be removed. #}
  163. {% block layout_head_javascript_csrf %}
  164. <script>
  165. window.csrf = {
  166. 'enabled': '{{ shopware.csrfEnabled }}',
  167. 'mode': '{{ shopware.csrfMode }}'
  168. }
  169. </script>
  170. {% endblock %}
  171. {% if config('core.cart.wishlistEnabled') %}
  172. {% block layout_head_javascript_wishlist_state %}
  173. <script>
  174. window.customerLoggedInState = {{ context.customer is not null and not context.customer.guest ? 1 : 0 }};
  175. window.wishlistEnabled = {{ config('core.cart.wishlistEnabled') }};
  176. </script>
  177. {% endblock %}
  178. {% endif %}
  179. {# @internal tag:v6.5.0 - jQuery will be removed from the core. This block can be used to add jQuery as a `<script>`. #}
  180. {% block layout_head_javascript_jquery %}
  181. {% endblock %}
  182. {% block layout_head_javascript_hmr_mode %}
  183. {% if isHMRMode %}
  184. <script type="text/javascript" src="/_webpack_hot_proxy_/js/vendor-node.js" defer></script>
  185. <script type="text/javascript" src="/_webpack_hot_proxy_/js/vendor-shared.js" defer></script>
  186. <script type="text/javascript" src="/_webpack_hot_proxy_/js/runtime.js" defer></script>
  187. <script type="text/javascript" src="/_webpack_hot_proxy_/js/app.js" defer></script>
  188. {# The storefront entry is a combined entry point which contains all plugins & themes #}
  189. <script type="text/javascript" src="/_webpack_hot_proxy_/js/storefront.js" defer></script>
  190. {% else %}
  191. {% for file in theme_config('assets.js') %}
  192. <script type="text/javascript" src="{{ asset(file, 'theme') }}" defer></script>
  193. {% endfor %}
  194. {% endif %}
  195. {% endblock %}
  196. {% endif %}
  197. </head>
  198. {% endblock %}