Output og:image:url if the og:image exists I'm working on a website with Drupal 8 and the metatags module. I need to not output the metatag og:image:url if the og:image exists.




If it possible to do using the module? If not I would have to create a module for that?
I found a module that did something similar and just changed a bit:

function remove_generator_page_attachments_alter(array &amp;$attachments) {

  $has_image = false;
  $index_to_remove = -1;

  foreach ($attachments['#attached']['html_head'] as $key =&gt; $attachment) {

    if ($attachment[1] == 'og_image_url_0' || $attachment[1] == 'og_image_url') {
      $index_to_remove = $key;
    }

    if ($attachment[1] == 'og_image_0' || $attachment[1] == 'og_image') {
      $has_image = true;
    }
  }

  if($has_image &amp;&amp; $index_to_remove &gt; -1) {
    unset($attachments['#attached']['html_head'][$index_to_remove]);
  }

}