Override image-formatter.html.twig I'm looking for an option to override the image-formatter.html.twig template in my own theme. But in the HTML page output (twig debug is set to true) there's no option listed to override the formatter template. The only thing I see is:

&lt;!-- THEME DEBUG --&gt;
&lt;!-- THEME HOOK: 'image_formatter' --&gt;
&lt;!-- BEGIN OUTPUT from 'core/modules/image/templates/image-formatter.html.twig' --&gt;


I need to place a rel attribute for the link which surrounds the image.

I found a solution which uses the option that you can write your own field formatter in your own module. But that seems to be too complex for this simple task.
In your .theme file, add this suggestions alter hook (and flush caches so the new hook definition is picked up):

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function MYTHEME_theme_suggestions_image_formatter_alter(array &amp;$suggestions, array $variables) {
  $entity = $variables['item']-&gt;getEntity();
  $field_name = $variables['item']-&gt;getParent()-&gt;getName();
  $suggestions[] = 'image_formatter__' . $entity-&gt;getEntityTypeId() . '__' . $entity-&gt;bundle() . '__' . $field_name;
}


Then if you look at the twig_debug output, you should see something like:

&lt;!-- THEME DEBUG --&gt;
&lt;!-- THEME HOOK: 'image_formatter' --&gt;
&lt;!-- FILE NAME SUGGESTIONS:
   * image-formatter--node--article--field-image.html.twig
   x image-formatter.html.twig
--&gt;


Once that is done, you can create your template file called image-formatter--node--article--field-image.html.twig in the templates directory of your theme, flush caches again so the template is picked up, and override the template with any changes you'd like.

This should include a caveat that the code hasn't been thoroughly tested :)