I'm trying to set up a slideshow that's unique to each page. The code for this needs to be in page.html.twig
. I've got the slideshow mostly working, but I can only call the full image URL, not a custom image style of a specific size. How can I modify this code to call a specific image size?
{% for key, item in node.field_slides %}
{% if node.field_slides[key].entity %}
<figure class="swiper-slide">
<img class="swiper-image" src="{{ file_url(node.field_slides[key].entity.uri.value) }}" alt="{{ node.field_slides[key].alt }}" />
{% if node.field_slides[key].title %}
<figcaption class="swiper-caption">
<div class="swiper-user-content user-content">
{{ node.field_slides[key].title|striptags("<a>,<h1>,<h2>,<h3>,<h4>,<h5>,<h6>,<ol>,<p>,<table>,<ul>")|raw }}
</div><!--/.swiper-user-content.user-content-->
</figcaption><!--/.swiper-caption-->
{% endif %}
</figure><!--/.swiper-slide-->
{% endif %}
{% endfor %}
The bit where I'm calling the URL is:
{{ file_url(node.field_slides[key].entity.uri.value) }}
I've tried doing {{ dump(node.field_slides[key]) }}
to see if there was any data I could use, but every time I do that, I just get 500 error.
Any help would be greatly appreciated; I'm very new to Drupal, coming from WordPress. I think this is the last major hurdle before I can finish up this theme for my client.