I have inherited a site which had no image management. Instead each image field required you to upload an image instead of reuse an existing one. I enabled Media Browser and updated to 8.7. I am also using the following modules [these are the ones I have installed ontop of existing]:

  • embed
  • entity_embed
  • editor_advanced_link
  • inline_entity_form
  • entity_browser
  • media_entity_browser

The problem is every image, either added via an image filed or in CKEditor wysiwyg is now wrapped in a link to the image file:

<a href="/path-to-image/image.ext"><img src="/path-to-image/image.ext"></a>

Twig template: \core\modules\image\templates\image-formatter.html.twig

has the following:

{% if url %}
  <a href="{{ url }}">{{ image }}</a>
{% else %}
  {{ image }}
{% endif %}

But I cannot see where the URL is set in the CMS admin, or how to stop it creating a link to itself. So far I have just copied the template to my theme and removed the url, but I would like to know how to manage this properly.

1 Answer 1


In: structure -> media types -> image -> display


the image field settings had 'Link image to' -> file

Set this to nothing, removed the theme image-formatter.html.twig template and the file link added to each image was no longer there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.