templates/includes/blocks/newsSingleRelated.html.twig line 1

Open in your IDE?
  1. <br><br>
  2. {% set previous = sulu_content_load(content.previousArticle, {'title': 'title', 'url': 'url', 'image': 'image', 'date': 'date'}) %}
  3. {% set next = sulu_content_load(content.nextArticle, {'title': 'title', 'url': 'url', 'image': 'image', 'date': 'date'}) %}
  4. <div
  5.     class="grid sm:grid-cols-2 border divide-y sm:divide-y-0 divide-y-reverse sm:divide-x border-gray divide-gray text-blue mx-auto max-w-[928px]">
  6.     {# Prev #}
  7.     <div
  8.       class="prev-news relative py-6 px-8 hover:bg-blue focus-within:bg-blue hover:text-white focus-within:text-white duration-300 order-1 sm:order-none">
  9.       <a class="absolute inset-0 z-10 text-[0px] outline-none"
  10.         href="{{ sulu_content_path(previous.content.url) }}">
  11.         {{ content.previousText }}
  12.       </a>
  13.       <div class="flex items-center gap-[10px]">
  14.         <svg class="w-6 h-2">
  15.           <use xlink:href="#arrow-prev"></use>
  16.         </svg>
  17.         <span>{{ content.previousText }}</span>
  18.       </div>
  19.       <div class="flex gap-3 mt-3">
  20.         <div class="w-20 h-20 flex-shrink-0">
  21.           {# Image size 100*100 #}
  22.           {% if previous.content.image|length > 0 %}
  23.           {% set image = previous.content.image.thumbnails['100x100'] %}
  24.           <img class="w-full h-full object-cover"
  25.             src="{{ image }}"
  26.             alt="{{ previous.content.title }}"
  27.             loading="lazy">
  28.           {% endif %}
  29.         </div>
  30.         <div>
  31.           <p class="title text-xl">{{ previous.content.title }}</p>
  32.           <time class="block text-sm mt-3 whitespace-nowrap">{{ previous.content.date|date('d M, Y') }}</time>
  33.         </div>
  34.       </div>
  35.     </div>
  36.  
  37.     {# Next #}
  38.     <div
  39.       class="next-news relative py-6 px-8 hover:bg-blue focus-within:bg-blue hover:text-white focus-within:text-white duration-300">
  40.       <a class="absolute inset-0 z-10 text-[0px] outline-none"
  41.         href="{{ sulu_content_path(next.content.url) }}">
  42.         {{ content.nextText }}
  43.       </a>
  44.       <div class="flex justify-end items-center gap-[10px]">
  45.         <span>{{ content.nextText }}</span>
  46.         <svg class="w-6 h-2">
  47.           <use xlink:href="#arrow-next"></use>
  48.         </svg>
  49.       </div>
  50.       <div class="flex gap-3 mt-3">
  51.         <div>
  52.           <p class="title text-xl">{{ next.content.title }}</p>
  53.           <time class="block text-sm mt-3 whitespace-nowrap">{{ next.content.date|date('d M, Y') }}</time>
  54.         </div>
  55.         <div class="w-20 h-20 flex-shrink-0">
  56.           {# Image size 100*100 #}
  57.           {% if next.content.image|length > 0 %}
  58.           {% set image = next.content.image.thumbnails['100x100'] %}
  59.           <img class="w-full h-full object-cover"
  60.             src="{{ image }}"
  61.             alt="{{ next.content.title }}"
  62.             loading="lazy">
  63.           {% endif %}
  64.         </div>
  65.       </div>
  66.     </div>