Drupal - Drupal 8 Metatag and Media Entity modules to set meta image tags

If I understand your question correctly you'll need to do the following:

  • Check on your modules page that the "Metatag: Open Graph" submodule is enabled.
  • Go to metatag config page (Configuration > Search and metadata > Metatag).
  • Add a new "default metatag" and select your content type in the "Type" selectbox.
  • Fill in the rest of the fields similar like following picture (just don't forget to use your own field names:

enter image description here

Here are some things you need to know about my tokens:

  • field_teaser_img: is the fieldname of my media entityreference on my content type.
  • field_me_img: is the fieldname of my image field on my media entity type.
  • facebook: is the imagestyle name I created for these metatags
  • height, mimetype & width: are property fields of the media entity type yet I didn't create those fields but it does seem to work.

I hope this helps.

Tags:

Media

Meta Tags

8