Skip to content

Commit

Permalink
Update OptimizeHeroImages::generateImg() to add fetchpriority attr …
Browse files Browse the repository at this point in the history
…on hero images
  • Loading branch information
thelovekesh committed Oct 19, 2023
1 parent 387eaff commit e757cc1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Optimizer/Transformer/OptimizeHeroImages.php
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ private function generateImg(HeroImage $heroImage, Document $document)
$imgElement = $document->createElement(Tag::IMG);
$imgElement->setAttribute(Attribute::CLASS_, self::SSR_IMAGE_CLASS);
$imgElement->setAttribute(Attribute::DECODING, 'async');
$imgElement->setAttribute(Attribute::FETCHPRIORITY, 'high');

// If the image was detected as hero image candidate (and thus lacks an explicit data-hero), mark it as a hero
// and add loading=lazy to guard against making the page performance even worse by eagerly loading an image
Expand Down

0 comments on commit e757cc1

Please sign in to comment.