Skip to content

Include candidate hero images after paragraphs and persist loading attribute on noscript > img fallback#149

Merged
schlessera merged 4 commits intomainfrom
update/hero-image-ssr
Apr 13, 2021
Merged

Include candidate hero images after paragraphs and persist loading attribute on noscript > img fallback#149
schlessera merged 4 commits intomainfrom
update/hero-image-ssr

Conversation

@westonruter
Copy link
Copy Markdown
Member

@westonruter westonruter commented Apr 11, 2021

  • Honor hero image candidate (with data-hero-candidate) even when they occur after multiple paragraphs. This fixes an issue I saw in Twenty Twenty-One where there multiple paragraphs in the header, preventing any images in the entry content from being made heros via the AMP plugin's DetermineHeroImages transformer.
  • When prerendering a hero image, persist the loading attribute from its noscript > img fallback. If the fallback img lacks a loading attribute (as in the case of the Custom Logo in WordPress), omit it from the SSR'ed img as well. If the fallback img has loading=lazy, then add it to the SSR'ed image as well (as is done for content images in WP). Fixes Evaluate improved lazy-loading behavior for hero images #147. Done in Improve logic to detect explicitly marked hero images amp-toolbox#1198 via ampproject/amp-toolbox@16a1a85.

@westonruter westonruter requested a review from schlessera April 11, 2021 05:20
@westonruter westonruter changed the title Update/hero image ssr Include candidate hero images after paragraphs and persist loading attribute on noscript > img fallback Apr 11, 2021
westonruter added a commit to ampproject/amp-wp that referenced this pull request Apr 11, 2021
westonruter added a commit to ampproject/amp-wp that referenced this pull request Apr 11, 2021
@westonruter
Copy link
Copy Markdown
Member Author

Upstream PR has been merged.

@schlessera schlessera merged commit 9e6edcf into main Apr 13, 2021
@schlessera schlessera deleted the update/hero-image-ssr branch April 13, 2021 17:37
@westonruter westonruter added the SSR Related to the serverside rendering of the Optimizer label Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Optimizer Performance SSR Related to the serverside rendering of the Optimizer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Evaluate improved lazy-loading behavior for hero images

2 participants