templates/base.html.twig line 1

Open in your IDE?
  1. {% extends "@Components/layout-base/layout-base.twig" %}
  2. {% block meta %}
  3.     {% set robots = 'all' %}
  4.     {% if meta.noIndex and meta.noFollow %}
  5.         {% set robots = 'noindex, nofollow' %}
  6.     {% elseif meta.noIndex %}
  7.         {% set robots = 'noindex, follow' %}
  8.     {% elseif meta.noFollow %}
  9.         {% set robots = 'index, nofollow' %}
  10.     {% endif %}
  11.     <meta name="robots" content="{{ robots }}">
  12.     {% if meta.description %}
  13.         <meta name="description" content="{{ meta.description }}" />
  14.     {% endif %}
  15.     {% if meta.keywords %}
  16.         <meta name="keywords" content="{{ meta.keywords }}" />
  17.     {% endif %}
  18.     {% if meta.canonicalUrl %}
  19.         <link rel="canonical" href="{{ meta.canonicalUrl }}" />
  20.         <meta property="og:url" content="{{ meta.canonicalUrl }}" />
  21.         <meta name="twitter:url" content="{{ meta.canonicalUrl }}" />
  22.     {% endif %}
  23.     {#  OG  #}
  24.     {% if meta.locale %}
  25.         <meta property="og:locale" content="{{ meta.locale|getLanguageFromLocale }}" />
  26.     {% endif %}
  27.     {% if meta.siteName %}
  28.         <meta property="og:site_name" content="{{ meta.siteName }}" />
  29.     {% endif %}
  30.     {% if meta.ogTitle %}
  31.         <meta property="og:title" content="{{ meta.ogTitle }}" />
  32.     {% endif %}
  33.     {% if meta.ogDescription %}
  34.         <meta property="og:description" content="{{ meta.ogDescription }}" />
  35.     {% endif %}
  36.     {% if meta.published %}
  37.         <meta property="article:published_time" content="{{ meta.published|date(constant('\DateTime::ATOM')) }}" />
  38.     {% endif %}
  39.     <meta property="og:type" content="website" />
  40.     {% if meta.ogImages %}
  41.         {% set ogImages = sulu_resolve_medias(meta.ogImages, locale) %}
  42.         {% for image in ogImages %}
  43.             <meta property="og:image" content="{{ absolute_url(image.thumbnails['1200x630']) }}" />
  44.             <meta property="og:image:width" content="1200" />
  45.             <meta property="og:image:height" content="630" />
  46.         {% endfor %}
  47.     {% endif %}
  48.     {#  TWITTER  #}
  49.     <meta name="twitter:card" content="summary_large_image" />
  50.     {% if meta.twitterTitle %}
  51.         <meta name="twitter:title" content="{{ meta.twitterTitle }}" />
  52.     {% endif %}
  53.     {% if meta.twitterDescription %}
  54.         <meta name="twitter:description" content="{{ meta.twitterDescription }}" />
  55.     {% endif %}
  56.     {% if meta.twitterImages %}
  57.         {% set twitterImages = sulu_resolve_medias(meta.twitterImages, locale) %}
  58.         {% for image in twitterImages %}
  59.             <meta property="twitter:image" content="{{ absolute_url(image.thumbnails['800x400']) }}" />
  60.         {% endfor %}
  61.     {% endif %}
  62. {% endblock %}
  63. {% block title %}
  64.     {% if meta.title and meta.siteName %}
  65.         {% set title = meta.title ~ ' - ' ~ meta.siteName %}
  66.     {% elseif meta.title %}
  67.         {% set title = meta.title %}
  68.     {% elseif meta.siteName %}
  69.         {% set title = meta.siteName %}
  70.     {% endif %}
  71.     {{ title }}
  72. {% endblock %}
  73. {% set alertItems = [] %}
  74. {% for type, messages in app.flashes() %}
  75.     {% for message in messages %}
  76.         {% set alertItems = alertItems|merge([
  77.             {
  78.                 variant: type,
  79.                 content: message,
  80.             }
  81.         ]) %}
  82.     {% endfor %}
  83. {% endfor %}
  84. {% if alertItems %}
  85.     {% set alerts = {
  86.         items: alertItems
  87.     } %}
  88. {% endif %}