-
Notifications
You must be signed in to change notification settings - Fork 885
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
19849 og image tags are not showing the biggest available image when a resized version is used in the content #21534
Conversation
…image-tags-are-not-showing-the-biggest-available-image-when-a-resized-version-is-used-in-the-content
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this PR, we introduce parsing the post content in the post indexable builder, which means that we now do the heavy lifting of searching for images whenever we try to build a post indexable.
I have some fundamental issues with the performance of this, let me try to articulate them below, to have them in one place:
- If a post hasn't had its indexable built yet, accessing that post in the frontend will take much more time than before, due to us trying to search for image IDs on page load.
- Which also means that, if a site has disabled the indexable creation (eg. a staging site), every time that a post is visited the post content is going to be searched again
- If indexables are not yet build (eg. in a site that just had Yoast installed) and you visit the All posts page in the admin, our new flow will search the content of a lot of posts in a single request, which is bound to face performance issues in the wild, especially if there are a couple of long posts there.
- On post creation, the content is going to be searched for images twice, once for this new feature and one for the old feature of link building. (This can be rectified using cache, so we do the heavy lifting once per request)
What makes things worse is that the addition of all this performance overheard might be in vain, as we know that this new image search is not compatible with a lot of cases (eg. the classic editor's and Elementor's galleries).
🐛 A direct effect of us introducing this content parsing is that we now get OOM errors because of an infinite loop, whenever there's the |
One possible alternative approach could be:
The advantage of this approach is that we keep the heavy lifting of searching for image IDs where it originally was (on the post creation or the SEOO) so we don't add performance overhead then. Worth to note that the performance overhead of this approach is negligible, because the extra calculations described above don't require extra db read, since everything we need is already in our disposal (including the OG image source). |
Pull Request Test Coverage Report for Build 9ff9ba3bbe5b6fba43f1cf478a9c991578c14c24Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR: 🚧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acceptance: 🟠 (Looks good, a couple of minor things below)
3 notes:
Note 1:
As per the comment below, I think we need an additional check to prevent empty IDs from being stored in the indexable database. When that's done, another quick smoke test round should happen and we should be good to merge.
Note 2:
We are now outputting the og:image:width|height|type
tags for when a first content image is used for OG images, whereas we didn't before. I assume it's fine because it's how we do when a featured image is selected for OG image, but best to check with product/SEO team, for explicit approval.
Note 3:
Now, when a first content image is used for the OG/Twitter images, an ID is stored in the indexable. But that ID is not stored in the post meta, where we would expect to find it in the _yoast_wpseo_opengraph-image-id
, which is what happens eg. when we set an OG image in the Social tab. I didn't find any regressions due to that and it already was the same case when we used the feature image for the OG image, so I'm mentioning this just for future reference and I think it's worth a double check from you @thijsoo .
…image-tags-are-not-showing-the-biggest-available-image-when-a-resized-version-is-used-in-the-content
Context
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
Note: The improvement doesn't work if indexables haven't been built, we will publish a relevant note in the docs about this.
"og:image"
tag.og:image:width|height|type
tags, so make sure they are correct.twitter_image_id
andopen_graph_image_id
are filled in.Enable media pages
to true in Yoast settings and resetting the indexables.Relevant test scenarios
Test instructions for QA when the code is in the RC
QA can test this PR by following these steps:
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
Since this PR touches the core way the first content image is set. All ways of setting the OG and Twitter images should be smoke tested, and it needs to be made sure that the priorities still work as expected.
We also moved the getting info from images to its own class which was introduced here: #20380. So these steps should be repeated as a regression test.
UI changes
Other environments
[shopify-seo]
, added test instructions for Shopify and attached theShopify
label to this PR.Documentation
Quality assurance
Innovation
innovation
label.Fixes #