<p>Could you please let us know where do you output the <code>{% sproutseo 'optimize' %}</code>tag?</p>

<p>The <code>{% do craft.sproutSeo.meta({</code> tag need to be called before the <code>optimize</code> tag. I'll give you a basic example of how you can do this:</p>

<p>Let's say that you have a <code>_layout</code> where you have the html <code>head</code> tag:</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"&gt;
&lt;head&gt;
    {% block head %}
        {% sproutseo 'optimize' %}
        ...
        ...
    {% endblock %}
    ...
&lt;/head&gt;
</code></pre>

<p>In your <code>section/_entry</code> (extends your layout) When you need to override something with the <code>do craft.sproutSeo.meta</code> you may need to call it before the <code>{% sproutseo 'optimize' %}</code> so you can do something like:</p>

<pre><code>{% extends "_layout" %}
{% set title = entry.title ~ " - Blog" %}

{% block head %}

    {% set cardEntryImage = craft.imager.transformImage(entry.blogHeaderImage.first(), { width: 1920, ratio: 16/9 }) %}
    {% do craft.sproutSeo.meta({
        ogImage: siteUrl ~ cardEntryImage.getUrl(),
        ogImageSecure: siteUrl ~ cardEntryImage.getUrl(),
        ogImageHeight: cardEntryImage.getHeight(),
        ogImageWidth: cardEntryImage.getWidth(),
        ogImageType: cardEntryImage.getMimeType(),
        twitterImage: siteUrl ~ cardEntryImage.getUrl()
    }) %}
    {{ parent() }}

    ...
    ...
{% endblock %}
</code></pre>

<p>Best,</p>

<p>-Andre L</p>

CC BY-SA 3.0
2018-03-28T11:17:42.570Z
That works! thanks! I had the call to optimize before doing the overrides, as indicated in the (wrong at the time but now fixed) documentation
mrsmn
CC BY-SA 3.0
2018-03-27T19:51:11.723Z
2018-03-28T07:21:27.727Z
2018-03-28T07:21:27.727Z
Andre L.
<p>So I have what <em>seems</em> like a simple problem but can't quite find a solution. On my entry template I'm trying to override the image fields as we're using the imager plugin for transforms. However, it doesn't seem to be working at all. No matter what I put inside the <code>craft.sproutSeo.meta</code> do loop, nothing happens. Even if I hardcode a value in there. It seems simple, but is there something I'm missing here? My code is below:</p>

<pre><code>{% set cardEntryImage = craft.imager.transformImage(entry.blogHeaderImage.first(), { width: 1920, ratio: 16/9 }) %}
{% do craft.sproutSeo.meta({
    ogImage: siteUrl ~ cardEntryImage.getUrl(),
    ogImageSecure: siteUrl ~ cardEntryImage.getUrl(),
    ogImageHeight: cardEntryImage.getHeight(),
    ogImageWidth: cardEntryImage.getWidth(),
    ogImageType: cardEntryImage.getMimeType(),
    twitterImage: siteUrl ~ cardEntryImage.getUrl()
}) %}
</code></pre>

CC BY-SA 3.0
2018-03-22T13:42:25.290Z
I'm facing the exact same problem so this is not an answer but more a bump, sorry for that. Based on this page at their docs ([link](https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/advanced-customization/template-overrides)), the method described above should work... But for me it isn't. I've contacted the Sprout support as well, will post back here if I get an answer.
mrsmn
<plugin-sproutseo>
Sprout SEO 3 Image Override Not Working
# Sprout SEO 3 Image Override Not Working

(Asked by: username_0 on 2017-05-18)

So I have what seems like a simple problem but can't quite find a solution. On my entry template I'm trying to override the image fields as we're using the imager plugin for transforms. However, it doesn't seem to be working at all. No matter what I put inside the craft.sproutSeo.meta do loop, nothing happens. Even if I hardcode a value in there. It seems simple, but is there something I'm missing here? My code is below:
{% set cardEntryImage = craft.imager.transformImage(entry.blogHeaderImage.first(), { width: 1920, ratio: 16/9 }) %}
{% do craft.sproutSeo.meta({
    ogImage: siteUrl ~ cardEntryImage.getUrl(),
    ogImageSecure: siteUrl ~ cardEntryImage.getUrl(),
    ogImageHeight: cardEntryImage.getHeight(),
    ogImageWidth: cardEntryImage.getWidth(),
    ogImageType: cardEntryImage.getMimeType(),
    twitterImage: siteUrl ~ cardEntryImage.getUrl()
}) %}

**Tags:** plugin-sproutseo
> **Comments:**
> **username_1**: I'm facing the exact same problem so this is not an answer but more a bump, sorry for that. Based on this page at their docs ([link](https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/advanced-customization/template-overrides)), the method described above should work... But for me it isn't. I've contacted the Sprout support as well, will post back here if I get an answer.  

---

## 1 answers

### Answer by username_2 on 2018-03-27. Score: 2

Could you please let us know where do you output the {% sproutseo 'optimize' %}tag?
The {% do craft.sproutSeo.meta({ tag need to be called before the optimize tag. I'll give you a basic example of how you can do this:
Let's say that you have a _layout where you have the html head tag:



    {% block head %}
        {% sproutseo 'optimize' %}
        ...
        ...
    {% endblock %}
    ...


In your section/_entry (extends your layout) When you need to override something with the do craft.sproutSeo.meta you may need to call it before the {% sproutseo 'optimize' %} so you can do something like:
{% extends "_layout" %}
{% set title = entry.title ~ " - Blog" %}

{% block head %}

    {% set cardEntryImage = craft.imager.transformImage(entry.blogHeaderImage.first(), { width: 1920, ratio: 16/9 }) %}
    {% do craft.sproutSeo.meta({
        ogImage: siteUrl ~ cardEntryImage.getUrl(),
        ogImageSecure: siteUrl ~ cardEntryImage.getUrl(),
        ogImageHeight: cardEntryImage.getHeight(),
        ogImageWidth: cardEntryImage.getWidth(),
        ogImageType: cardEntryImage.getMimeType(),
        twitterImage: siteUrl ~ cardEntryImage.getUrl()
    }) %}
    {{ parent() }}

    ...
    ...
{% endblock %}

Best,
-Andre L

> **Comments:**
> **username_1**: That works! thanks! I had the call to optimize before doing the overrides, as indicated in the (wrong at the time but now fixed) documentation  

---

