Answers.Body: <p>Since SEOmatic fields are parsed as object templates, you'll need to preface things like <code>entry</code> with <code>object.</code>, e.g.:</p>
  
  <pre><code>{% set hero = object.entry.heroImages.one() %}{% set image = hero.image.one() %}{{ image.url }} 
  
  </code></pre>
  
  <p>c.f.: <a href="https://github.com/nystudio107/craft-seomatic#content-seo-control-panel-fields" rel="nofollow noreferrer">https://github.com/nystudio107/craft-seomatic#content-seo-control-panel-fields</a></p>
  
  <p>Note that you could also do this entirely in your Twig template, like this:</p>
  
  <pre><code>{% set hero = entry.heroImages.one() %}
  {% set image = hero.image.one() %}
  {% do seomatic.meta.seoImage(image.url) %}
  {% do seomatic.meta.twitterImage(image.url) %}
  {% do seomatic.meta.ogImage(image.url) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-21T19:03:36.963Z
Answers.LastActivityDate: 2019-05-21T19:03:36.963Z
Answers.UserDisplayName: andrew.welch
Body: <p>I'm using a matrix for hero images on my pages, and I'd like to use them as the SEO image in SEOMatic, but it's not available in the settings.</p>
  
  <p>I tried setting the field to "Custom URL" and adding twig code:</p>
  
  <pre><code>{% set hero = entry.heroImages.one() %}{% set image = hero.image.one() %}{{ image.url }} 
  </code></pre>
  
  <p>If I place this in my template, it displays the path to the first matrix image, but SEOMatic seems to ignore it.</p>
  
  <p>Is there another way to configure things to use my matrix images?</p>
  
Tags: <plugin-seomatic>
Title: SEOMatic: Get SEO Image from a Matrix Field
ThreadText: # SEOMatic: Get SEO Image from a Matrix Field
  
  (Asked by: username_0 on 2019-05-21)
  
  I'm using a matrix for hero images on my pages, and I'd like to use them as the SEO image in SEOMatic, but it's not available in the settings.
  
  I tried setting the field to "Custom URL" and adding twig code:
  
  ```
  {% set hero = entry.heroImages.one() %}{% set image = hero.image.one() %}{{ image.url }} 
  
  ```
  
  If I place this in my template, it displays the path to the first matrix image, but SEOMatic seems to ignore it.
  
  Is there another way to configure things to use my matrix images?
  
  **Tags:** plugin-seomatic
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-05-21. Score: 1 | Accepted answer
  
  Since SEOmatic fields are parsed as object templates, you'll need to preface things like `entry` with `object.`, e.g.:
  
  ```
  {% set hero = object.entry.heroImages.one() %}{% set image = hero.image.one() %}{{ image.url }} 
  
  ```
  
  c.f.: <https://github.com/nystudio107/craft-seomatic#content-seo-control-panel-fields>
  
  Note that you could also do this entirely in your Twig template, like this:
  
  ```
  {% set hero = entry.heroImages.one() %}
  {% set image = hero.image.one() %}
  {% do seomatic.meta.seoImage(image.url) %}
  {% do seomatic.meta.twitterImage(image.url) %}
  {% do seomatic.meta.ogImage(image.url) %}
  
  ```
  
  
  ---
  
  