New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SEO Image Source (Global SEO) #1364
Comments
Unfortunately, that's not how it works. If you put this in your template before you set the
You'll see something like this:
When you change just the {% do seomatic.meta.setAttributes({ "seoImage" : "[Asset B" }) %} ...it doesn't magically change the other settings in So the solution would be to change all 3 to what you want them to be in this custom template: {% do seomatic.meta.setAttributes({
"seoImage" : "[Asset B",
"ogImage" : "[Asset B",
"twitterImage" : "[Asset B",
}) %} |
I should clarify that the above only happens if you have "Transform Open Graph Image" and/or "Transform Twitter Image" on. If you turn those off, when you dump
Since they now are both set to "{seomatic.meta.seoImage}", changing the |
Addressed in: f486961 & 63b5efd This will turn off the Transform Image setting by default for Twitter & Facebook images, since both default to "Same as SEO Image" in the settings... and this behavior you're seeing will "just work" as you'd expect. Craft CMS 3: You can try it now by setting your semver in your "nystudio107/craft-seomatic": "dev-develop as 3.4.62”, Then do a ….. Craft CMS 4: You can try it now by setting your semver in your "nystudio107/craft-seomatic": "dev-develop-v4 as 4.0.32”, Then do a |
@khalwat Thanks for the clarification. I think I understand the behaviour now and can definitely find a way to make it work by the means explained. However, I still think, the behaviour may be slightly off when switching to "Custom URL". In that case it the previously defined Image Asset A is used for seoImage but the override of seoImage in the twig template results in all three images (seoImage, ogImage and twitterImage) being overridden. Or is that on purpose? |
Describe the bug
I have the following settings on "Global SEO" with regards to images:
Also, I have a dynamic (not directly related to an Entry) template, where I manually set
{% do seomatic.meta.setAttributes({ "seoImage" : "[Asset B" }) %}
Expected behaviour
Expected: If I render the page like this, the Twitter and Facebook SEO images are set to "Asset B"
Actual behaviour
Expected: If I render the page like this, the Twitter and Facebook SEO images are set to "Asset A"
Now, the interesting part is: if I set General -> SEO Image Source to "Custom URL", which defaults to
{{ seomatic.helper.socialTransform([ID of Asset A], "base", 1, "crop") }}
the rendering is as expected. As soon as I change back to the actual Image, it does not work anymore.
According to my understanding, this image should serve as a fallback if no other value is defined?
Versions
The text was updated successfully, but these errors were encountered: