-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Add fixed sizes for some images to prevent errors #2087
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
Conversation
|
Has the change to make the width argument optional been merged already ? |
|
@bakura10 From the sound of it, it always was the case but I'm a bit skeptical. Which is why I had not asked for reviews yet. I should change the status to |
|
100% sure it was not the case :D. The image_url used to fail if you did not pass a width attribute so it would be nice to have a confirmation indeed :) |
|
Yeah you're right it's still failing. I'm getting Ill change the PR to use a width of |
eugenekasimov
left a comment
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.
Hey Ludo. I think your approach fixes the current issue. I left a minor comment about my concern.
Based on what I have learned about Schema.org it may be a good idea to have a few alternative versions of images (different resolutions and/or aspect ratios). It can improve a search result for pages. It can be as a follow up PR though. Let me know what you think about it. Thanks.
sections/main-article.liquid
Outdated
| "height": {{ settings.share_image.height | json }}, | ||
| "url": {{ settings.share_image | image_url: width: settings.share_image.width | prepend: "https:" | json }}, | ||
| "url": {{ settings.share_image | image_url: width: 1920 | prepend: "https:" | json }}, | ||
| "width": {{ settings.share_image.width | json }} |
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.
I'm not sure for 100% but I can assume that "height": and "width": may lead to the same error in our case. I would remove them, or leave only one of them with fixed value. What do you think?
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.
I'm not sure I follow.
or leave only one of them with fixed value
Isn't it what I'm doing in the PR already ^ ?
As for adding multiple images, yeah I think it could be done as a follow up if we see it's necessary 👍
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.
I'm sorry Ludo, it seems like I'm bad at explaining. My concern is next:
- line 281 - you provide
urlwith fixedwidth: 1920. - line 282 - you provide
widthwith valuesettings.share_image.widththat may pass an original size of an image and it can be 5000px or bigger.
So, there shouldn't be an error in Liquid as it was before this PR but I just wanna be sure that there is no conflict or potential issue for merchants for their search optimization. Because I don't know what happens in case when the actual image is pulled through the url has width 1920px, but at the same time we are telling Schema.org to use width: settings.share_image.width which can be 5000px for example.
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.
Oh I see what you mean 👍 good point, thanks for bringing it up 🙂
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.
Makes me realize that this part is never coming up as there isn't any settings.share_image on the theme. Must have been added by mistake to replicate a previous behaviour. So I'll just remove it for now 👍
Doesn't seem to be the most important piece of information anyway when I look at the article structured data guidelines.
| "url": {{ settings.share_image | image_url: width: settings.share_image.width | prepend: "https:" | json }}, | ||
| "width": {{ settings.share_image.width | json }} | ||
| }, | ||
| {% endif %} |
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.
Removed this as it's not outputting ever as a share_image setting doesn't exists.
eugenekasimov
left a comment
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.
Looking good 🚀
commit dc81806 Author: Ken Meleta <[email protected]> Date: Tue Nov 22 13:32:46 2022 -0700 Add media sizing settings to featured product (Shopify#2114) commit 9875aea Author: Ken Meleta <[email protected]> Date: Tue Nov 22 13:17:55 2022 -0700 Adjust constrain media values for quick add modal (Shopify#2113) * Adjust constrain media values for quickadd * Adjust offset logic * Minor formatting fix commit 2eb8bf6 Author: Ludo <[email protected]> Date: Tue Nov 22 11:50:50 2022 -0500 Add fixed sizes for some images to prevent errors (Shopify#2087) * remove the mention of sizes where unnecessary * remove another instance * add fixed size to the images in structured data * adjust size to 1920 * edit logo size in structured data * remove conditional info * change value to match other logo size values commit 2f9b9f3 Author: Ludo <[email protected]> Date: Mon Nov 21 15:44:24 2022 -0500 Remove alt attribute in image_tag filter where unnecessary (Shopify#2117) * Add fallback to alt attribute where image_tag filter is used * remove unnecessary use of alt attribute in image_tag filter commit 251e5d9 Author: Ludo <[email protected]> Date: Mon Nov 21 12:18:44 2022 -0500 Move share button into a snippet (Shopify#2123) * Move share button into a snippet * change the property name to context and add details in snippet * address review comments * edit props names and description * Address reviewers comment. Remove unused prop and edit existing ID * move script at the top commit 539af27 Author: Eugene Kasimov <[email protected]> Date: Mon Nov 21 09:01:58 2022 -0800 Prettier liquid files snippets. (Shopify#2115) commit 503fdf8 Author: Eugene Kasimov <[email protected]> Date: Thu Nov 17 08:51:21 2022 -0800 Remove noscript css import for product recommendations (Shopify#2101) commit b2b01fd Author: Eugene Kasimov <[email protected]> Date: Thu Nov 17 08:50:33 2022 -0800 Change variables names (Shopify#2055) commit cf05d0d Author: Francisca Calabria Rubio <[email protected]> Date: Thu Nov 17 16:50:55 2022 +0100 Select text input content on trapFocus (Shopify#2106) * Select text input content on trapFocus * PR fix commit b86d1f3 Author: Ken Meleta <[email protected]> Date: Thu Nov 17 08:50:43 2022 -0700 Change thumbnail media fit to "fill" by default (Shopify#2044) * Change thumbnail media fit to cover by default * Simplify and cleanup thumbnail fit approach commit 8ab8e61 Author: Ludo <[email protected]> Date: Thu Nov 17 10:50:28 2022 -0500 Tweak the image_url size to be the max value where necessary (Shopify#2110) * Tweak the image_url size to be the max value where necessary * fix sizing in the header. commit c337301 Author: translation-platform[bot] <34770790+translation-platform[bot]@users.noreply.github.com> Date: Thu Nov 17 10:49:52 2022 -0500 Update 1 translation file (Shopify#2130) Co-authored-by: translation-platform[bot] <34770790+translation-platform[bot]@users.noreply.github.com> commit bc8f433 Author: Ken Meleta <[email protected]> Date: Thu Nov 17 08:49:10 2022 -0700 Add constrain media and media fit settings to product page (Shopify#2052) * Add constrain height setting * Add constrain scaling functionality * Add media fit setting and functionality * Quick add override and typo fixes * Update setting language and code cosmetics * Update 8 translation files * Update 5 translation files * Update 3 translation files * Update 3 translation files * Update 1 translation file * Add comment Co-authored-by: translation-platform[bot] <34770790+translation-platform[bot]@users.noreply.github.com>
* remove the mention of sizes where unnecessary * remove another instance * add fixed size to the images in structured data * adjust size to 1920 * edit logo size in structured data * remove conditional info * change value to match other logo size values
* remove the mention of sizes where unnecessary * remove another instance * add fixed size to the images in structured data * adjust size to 1920 * edit logo size in structured data * remove conditional info * change value to match other logo size values
PR Summary:
In a few places we're passing in the width of our images as an argument for the
image_urlfilter. This can create issues as there is a limit being checked and images can't be wider than5760.So I'm adding a fixed width to those so we're not running into an issue.
Why are these changes introduced?
Fixes #1893
What approach did you take?
Added a fixed size, Google states:
Images must be at least 160×90 pixels and at most 1920×1080 pixels.Other considerations
On the issue there was some chat about the filter itself applying a limit to size that can be passed.
Decision log
Visual impact on existing themes
No visual impact expected.
Testing steps/scenarios
I haven't been able to replicate the issue brought up as I wasn't able to upload an image that was wider than
5760. I posted on the issue to see if I'm missing something in my replication steps.Demo links
Checklist