vendor/joppedc/sylius-better-seo-plugin/src/Resources/views/_seo_block.html.twig line 1

Open in your IDE?
  1. <script type="application/javascript">
  2.   appendHtml = function(element, html) {
  3.     var div = document.createElement('div');
  4.     div.innerHTML = html;
  5.     while (div.children.length > 0) {
  6.       element.appendChild(div.children[0]);
  7.     }
  8.   };
  9.   {% if settings.product is defined and settings.product.seo is defined %}
  10.     {% set seo = settings.product.seo %}
  11.     {% set original_resource = settings.product %}
  12.   {% endif %}
  13.   {% if settings.taxon is defined and settings.taxon.seo is defined %}
  14.     {% set original_resource = settings.taxon %}
  15.     {% set seo = settings.taxon.seo %}
  16.   {% endif %}
  17.     appendHtml(document.head, '<meta name="twitter:card" content="summary"></meta>');
  18.     appendHtml(document.head, '<meta name="og:type" content="website" />');
  19.   {% if seo is defined and seo is not null %}
  20.   {% if seo.image is not null %}
  21.     {% set source_image_path = seo.image.path %}
  22.     {% set original_image_path = source_image_path|imagine_filter('sylius_shop_seo_image') %}
  23.   {% endif %}
  24.     {% if seo.pageTitle %}
  25.       document.title = '{{ seo.pageTitle }}';
  26.     {% endif %}
  27.     {% if seo.twitterSite is not empty %}
  28.       appendHtml(document.head, '<meta name="twitter:site" content="{{ seo.twitterSite|e('js') }}" />');
  29.     {% endif %}
  30.     {% if seo.twitterTitle is not empty %}
  31.       appendHtml(document.head, '<meta name="twitter:title" content="{{ seo.twitterTitle|e('js') }}" />');
  32.     {% else %}
  33.       appendHtml(document.head, '<meta name="twitter:title" content="{{ original_resource.name|e('js') }}" />');
  34.     {% endif %}
  35.     {% if seo.twitterDescription is not empty %}
  36.       appendHtml(document.head, '<meta name="twitter:description" content="{{ seo.twitterDescription|e('js') }}" />');
  37.     {% else %}
  38.       appendHtml(document.head, '<meta name="twitter:description" content="{{ original_resource.description|e('js') }}" />');
  39.     {% endif %}
  40.     {% if seo.ogTitle is not empty %}
  41.       appendHtml(document.head, '<meta name="og:title" content="{{ seo.ogTitle|e('js') }}" />');
  42.     {% else %}
  43.       appendHtml(document.head, '<meta name="og:title" content="{{ original_resource.name|e('js') }}" />');
  44.     {% endif %}
  45.     {% if seo.ogDescription is not empty %}
  46.       appendHtml(document.head, '<meta name="og:description" content="{{ seo.ogDescription|e('js') }}" />');
  47.     {% else %}
  48.       appendHtml(document.head, '<meta name="og:description" content="{{ original_resource.description|e('js') }}" />');
  49.     {% endif %}
  50.     {% if original_image_path is defined %}
  51.       appendHtml(document.head, '<meta name="og:image" content="{{ original_image_path }}" />');
  52.     {% endif %}
  53.     {% if seo.extraTags is not empty %}
  54.       appendHtml(document.head,'{{ seo.extraTags|e('js') }}');
  55.     {% endif %}
  56.   {% else %}
  57.     appendHtml(document.head, '<meta name="twitter:title" content="{{ original_resource.name|e('js') }}" />');
  58.     appendHtml(document.head, '<meta name="twitter:description" content="{{ original_resource.description|e('js') }}" />');
  59.     appendHtml(document.head, '<meta name="og:title" content="{{ original_resource.name|e('js') }}" />');
  60.     appendHtml(document.head, '<meta name="og:description" content="{{ original_resource.description|e('js') }}" />');
  61.   {% endif %}
  62. </script>