- Issue created by @glynster
- πΊπΈUnited States DamienMcKenna NH, USA
Thank you for reporting the bug.
Have you tried other image meta tags, e.g. og:image_url, og:image:secure_url, twitter:image, etc?
- πΊπΈUnited States glynster
@DamienMcKenna
Adding og:image_url or og:image:secure_url in the image_src field unsets the tag altogether. I assume this could be the order in which they are generated? Advanced first
URLS that render:
[node:url]
[site:url]If I add the following:
[site:url][node:bsp_header:entity:bsp_media:entity:field_media_image]
Returned metatag:
image_src: '/link-to-image'
But added with just the [site:url]
image_src: 'site-url'
What else can I supply?
- πΊπΈUnited States DamienMcKenna NH, USA
That's weird - adding a value to og:image:url or og:image:secure_url shouldn't affect og:image at all. Are you using any other modules that relate to OpenGraph?
- πΊπΈUnited States glynster
Sorry I misunderstood what you said. The other metatag field all work as they should including og:image_url, og:image:secure_url, twitter:image. The issue is isolated to the advanced img_src. Somehow that is being adjusted.
We are not using any other additional modules that relate to OpenGraph. Again the issue is related only to the advanced (Generic) metatag img_src section. Please see screenshot.
- πΊπΈUnited States glynster
Okay so I think this might be a Drupal core issue?
it is a link and not meta in the head:
<link rel="image_src" href="/sites/default/files/2023-03/header_locations.jpg">
- πΊπΈUnited States DamienMcKenna NH, USA
I don't see anything in core related to image_src. Might it come from another module, or maybe the theme?
- πΊπΈUnited States glynster
This is definitely related to metatag as the url always updates when I update the Advanced image field within meta. I just set core Claro theme and the same result 'realtive url'. However in the global metatag section we have:
[site:url]sites/default/files/2023-03/organization.jpg
That renders fine as an absolute. If you add 2 tokens then it strips the [site:url]. What is odd is that if I add this to the other image urls all is good.
Sorry not helping much am I!
- πΊπΈUnited States glynster
I also disabled the Schema module just in case it was getting in the way.
- πΊπΈUnited States kruser
I'm seeing weird results with this. For example, using this same token in all the image meta fields: [node:field_social_media_image]
I get different results in the output:
<link rel="image_src" href="test image.jpg" /> (missing site URL and directory path) <meta property="og:image" content="https://www.site.org/sites/default/files/test%20image.jpg" /> (works) <meta property="og:image:url" content="https://www.site.orgtest image.jpg" /> (missing directory path) <meta property="og:image:secure_url" content="https://www.site.orgtest image.jpg" /> (missing directory path) <meta name="twitter:image" content="https://www.site.org/sites/default/files/test%20image.jpg" /> (works)
- ππΊHungary junkuncz Budapest
Looks like the reason of wrong image_src attribute is an incomplete Plugin annotation. Setting the "absolute_url" = TRUE gives the ability to output() function (/src/Plugin/metatag/Tag/MetaNameBase.php line 529 in version 2.0.0) to build an absolute url.
Patch is attached.
I don't know what about og:image:url and og:image:secure_url most probably it's a different issue.
- Status changed to Needs review
about 1 year ago 10:29am 14 December 2023 - last update
about 1 year ago 111 pass, 2 fail The last submitted patch, 11: metatag-image_src-3349990-11.patch, failed testing. View results β
- Status changed to Needs work
about 1 year ago 10:53am 14 December 2023 - ππΊHungary junkuncz Budapest
Upps! :( Unfortunately I have no time to fix the tests and I'm quite sure it's not because of this one line change. (Error: Call to undefined method PhpParser\Node\Name::getParts() -> seems like something is missing there).
- last update
about 1 year ago 111 pass, 2 fail - last update
about 1 year ago 111 pass, 2 fail - π¦πΉAustria fago Vienna
https://www.drupal.org/node/640498/qa β has the same 2 fails, but shows green tests on 7.4. So let's try that.
Patch seems simple enough, so let's do this.
- last update
about 1 year ago Composer require failure - last update
about 1 year ago Composer require failure - ππΊHungary junkuncz Budapest
"drupal/metatag dev-2.0.x requires php >=8.0 -> your php version (7.4.28) does not satisfy that requirement."
Looks like no chance without php8. - πΊπΈUnited States DamienMcKenna NH, USA
I'm rerunning the 2.0.x tests as they haven't ran in a while, it seems like they stem from the WebProfiler tests, which I'm considering removing anyway; we'll see what they say shortly: https://www.drupal.org/pift-ci-job/2824531 β
- πΊπΈUnited States DamienMcKenna NH, USA
The 2.0.x tests are currently failing, so I'm removing the Devel and WebProfiler tests: π Remove Devel, WebProfiler tests Needs review
- last update
about 1 year ago 109 pass - Status changed to Needs review
about 1 year ago 11:16am 15 December 2023 - πΊπΈUnited States DamienMcKenna NH, USA
I committed #3408825 so the tests for this should pass now.