<p>Make sure you're not doing this inside of a <code>{% block %}</code> or you will run into Twig Processing Order / Scoping issues.</p>

<p>There are some good examples of doing that here: <a href="https://github.com/nystudio107/seomatic/wiki/10.-Dynamic-Twig-SEO-Meta" rel="nofollow noreferrer">Dynamic Twig SEO Meta</a></p>

CC BY-SA 3.0
2018-01-16T09:15:07.007Z
Hey Andrew, thanks for the quick response. I'm definitely not inside of the {% block %} tags. I know it's working also because it's correctly merging the entry.title & entry.podcastDescription, but when it comes to the image maybe the page hasn't rendered the related item yet? Which makes it not load in the hook? In the entry template, I'm extending a custom base for this particular entry type: {% extends "base-episodes" %} and in base-episodes I have all the head information including {% hook 'seomaticRender' %} right after my above merge. Any help or insight would be greatly appreciated!
nathanielperales
CC BY-SA 3.0
2018-01-17T06:54:47.077Z
With `devMode` on, what happens if you put this in a `{% block %}` somewhere: `{{ dump(seomaticMeta) }}` -- it'll let you see what has actually been set.
andrew.welch
CC BY-SA 3.0
2018-01-16T02:00:43.767Z
2018-01-16T02:00:43.767Z
andrew.welch
<p>I have a pretty specific set up: posts get created via rss feeds and images are not attached to the specific posts, so instead in the entry template I use an image from a related entry. When I try to use the related entry's image as the SEO image and merge it with SEOmatic, it does not merge.</p>

<p>Has anyone ever tried doing this with SEOmatic? This is the code I'm using:</p>

<pre><code>{% if craft.entries.section('episode') %}
   {% set relatedPodcastImage = craft.entries.section('podcastChannel').relatedTo(entry).albumCoverPicture.first().getUrl('large') %}
      {% set seomaticMeta = seomaticMeta | merge(
            { og:
                  {
                  title: entry.title,
          description: entry.podcastDescription,
                  image: relatedPodcastImage
                  }
            },
        { twitter:
                  {
                  title: entry.title,
                  description: entry.podcastDescription,
                  image: relatedPodcastImage
                  }
            }
      ) %}
{% endif %}
</code></pre>

<templating><entries><relatedto><seo><plugin-seomatic>
SEOmatic not merging fields from a related entry
# SEOmatic not merging fields from a related entry

(Asked by: username_0 on 2018-01-16)

I have a pretty specific set up: posts get created via rss feeds and images are not attached to the specific posts, so instead in the entry template I use an image from a related entry. When I try to use the related entry's image as the SEO image and merge it with SEOmatic, it does not merge.
Has anyone ever tried doing this with SEOmatic? This is the code I'm using:
{% if craft.entries.section('episode') %}
   {% set relatedPodcastImage = craft.entries.section('podcastChannel').relatedTo(entry).albumCoverPicture.first().getUrl('large') %}
      {% set seomaticMeta = seomaticMeta | merge(
            { og:
                  {
                  title: entry.title,
          description: entry.podcastDescription,
                  image: relatedPodcastImage
                  }
            },
        { twitter:
                  {
                  title: entry.title,
                  description: entry.podcastDescription,
                  image: relatedPodcastImage
                  }
            }
      ) %}
{% endif %}

**Tags:** templating, entries, relatedto, seo, plugin-seomatic

---

## 1 answers

### Answer by username_1 on 2018-01-16. Score: 2

Make sure you're not doing this inside of a `{% block %}` or you will run into Twig Processing Order / Scoping issues.

There are some good examples of doing that here: [Dynamic Twig SEO Meta](https://github.com/nystudio107/seomatic/wiki/10.-Dynamic-Twig-SEO-Meta)

> **Comments:**
> **username_0**: Hey Andrew, thanks for the quick response. I'm definitely not inside of the {% block %} tags. I know it's working also because it's correctly merging the entry.title & entry.podcastDescription, but when it comes to the image maybe the page hasn't rendered the related item yet? Which makes it not load in the hook? In the entry template, I'm extending a custom base for this particular entry type: {% extends "base-episodes" %} and in base-episodes I have all the head information including {% hook 'seomaticRender' %} right after my above merge. Any help or insight would be greatly appreciated!  
> **username_1**: With `devMode` on, what happens if you put this in a `{% block %}` somewhere: `{{ dump(seomaticMeta) }}` -- it'll let you see what has actually been set.  

---

