Conversation
…oes not have all the scales present. Fixed and update tests.
davisagli
left a comment
There was a problem hiding this comment.
The presence of the original image didn't force the browser to choose it. But we set width and height to the original size and in most cases didn't set sizes, so the browser didn't have any way to know it could use a smaller scale.
I think setting sizes appropriately would allow the browser's scale selection to work better even if we did always include the original image. I have a slight preference for leaving the original image there, because if we remove it then it takes extra work to use it in the use cases where it's really what you need (i.e. full-width on a large monitor)
| alt="" | ||
| loading="lazy" | ||
| responsive={true} | ||
| sizes="(max-width: 940px) 100vw, 940px" |
There was a problem hiding this comment.
Ideally we should use a smaller size when there are multiple columns.
I don't love hardcoding the default width, but I don't have a better suggestion. We can't use CSS properties because the whole point of sizes is to give the browser enough information to pick the right image before CSS has loaded.
Co-authored-by: Steve Piercy <web@stevepiercy.com>
|
@stevepiercy I accepted all the suggestions, but David is working in the backend side, and we might amend them a bit the next days. Thanks! |
|
@sneridagh @davisagli please ping me again for a review when it's done cooking. |
|
Can someone else fix the broken links? I'm swamped. https://github.com/plone/volto/actions/runs/19663404467/job/56314471303?pr=7655 |
|
@stevepiercy it seems medium added some antibot measures... we cannot do anything about it. How do we proceed with this use cases? |
|
@sneridagh for Medium, ignore the entire domain with a regex in For the others, fix the links that redirect. |
…olto into donotaddoriginalimagetothesrcset * 'donotaddoriginalimagetothesrcset' of github.com:plone/volto: Apply suggestions from code review
|
@davisagli once plone/plone.volto#205 is merged and released, we can go for this one. We might want to amend the docs with the released p.volto version. @stevepiercy I amended the docs to reflect the latest changes. |
| alt="" | ||
| loading="lazy" | ||
| responsive={true} | ||
| sizes="auto, (max-width: 940px) 100vw, 940px" |
There was a problem hiding this comment.
It would be better if this were a configuration. Different themes may have different sizes.
davisagli
left a comment
There was a problem hiding this comment.
@sneridagh I took another look at this. I still think it would be nice to make the following improvements:
- Add a config setting for the widths, instead of hardcoding 940px. (Also ideally inject them from the config setting into the CSS properties to avoid duplication, but we can live without that.)
- Give the teaser block contextual information about how many columns there are, so it can use smaller sizes when there are multiple columns.
But, I would be okay with merging this and adding those improvements incrementally.
|
I would say that for the Our usecase was the following: The |
|
@erral This still includes the original image in the srcset unless it is enormous (width greater than the largest defined scale size, which is 4000 pixels in Plone 6.2) |
Follow up: #7486 (Seven PR):