Skip to content

VPI: add fetchpriority=high to VPI preload links#993

Merged
hi-hai merged 1 commit into
litespeedtech:devfrom
maciejmrozinski:vpi-preload-fetchpriority-high
Jun 8, 2026
Merged

VPI: add fetchpriority=high to VPI preload links#993
hi-hai merged 1 commit into
litespeedtech:devfrom
maciejmrozinski:vpi-preload-fetchpriority-high

Conversation

@maciejmrozinski

Copy link
Copy Markdown

Adds fetchpriority="high" to image preload links generated in finalize_head() to improve LCP resource prioritization.

This addresses the PageSpeed Insights warning about missing high fetch priority on the preloaded LCP image and helps browsers prioritize loading the main visual content earlier.

Firefox_Screenshot_2026-05-29T10-12-02 575Z

@timotei-litespeed

Copy link
Copy Markdown
Contributor

@maciejmrozinski Thank you for the improvement
We added fetchpriority="high" to the images code, directly there. Please check if that is present
Thank you

@maciejmrozinski

maciejmrozinski commented May 29, 2026

Copy link
Copy Markdown
Author

@timotei-litespeed Thanks for the clarification.
I agree that fetchpriority="high" is already correctly added to the <img> element itself.

However, the PageSpeed Insights warning specifically points to the preload request and suggests adding fetchpriority="high" directly to the <link rel="preload"> as well. That’s why I proposed this change.

My understanding is that PSI treats the preload request and the actual <img> request separately.

@timotei-litespeed

Copy link
Copy Markdown
Contributor

Is the LCP image as background image?

@maciejmrozinski

maciejmrozinski commented May 29, 2026

Copy link
Copy Markdown
Author

It’s the main product image on a WooCommerce product page, rendered as a standard <img> element.

Firefox_Screenshot_2026-05-29T11-18-56 343Z

@timotei-litespeed

Copy link
Copy Markdown
Contributor

Please check if the image is present in VPI list: mobile and desktop
Also, please send a report and share the ID. How to: https://docs.litespeedtech.com/lscache/lscwp/troubleshoot/#get-a-report-number

@maciejmrozinski

Copy link
Copy Markdown
Author

Thanks for the suggestion. I think we may be talking about two different things.

The LCP image itself is already rendered with fetchpriority="high" on the <img> element, so I'm not investigating an LCP image detection or VPI issue.

What I am referring to is the specific PageSpeed Insights warning about the preload request. PSI reports that fetchpriority="high" should also be present on the generated <link rel="preload"> tag in the document head.

So the question is not whether the correct image is identified as the LCP image, but whether adding fetchpriority="high" to the preload tag is something that should be supported by the plugin.

Could you clarify whether this is expected behavior or if there is a reason why the attribute is intentionally omitted from the preload tag?

@timotei-litespeed

Copy link
Copy Markdown
Contributor

@maciejmrozinski
Thank you for information about correct VPI images getting detected.
I have a test site and I have a image with fetchpriority added. I run the Google report and I see it as marked
image
Does not have preload added, just the fetchpriority

@maciejmrozinski

Copy link
Copy Markdown
Author

I think these are actually different test cases.

In your example there is no preload tag at all, only fetchpriority="high" on the <img> element. In that scenario, the PSI check for fetchpriority=high applied is naturally evaluating the <img> request.

In my case, the image is already being preloaded, so there is an additional <link rel="preload" as="image"> request. The PSI warning specifically says that fetchpriority="high" should also be applied to the image preload request, even though it is already present on the <img> element.

That's why I proposed adding the attribute to the generated preload tag. My understanding is that once a preload request exists, PSI evaluates that request separately from the <img> element itself.

@timotei-litespeed

timotei-litespeed commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

I see your point. Please make 2 changes:

  • fetchpriority="high" add the double quotes before and after high
  • change branch to commit to: from main to dev

I will forward the changes the developer team and we will be back with an answer

@maciejmrozinski maciejmrozinski changed the base branch from master to dev June 5, 2026 09:40
@maciejmrozinski maciejmrozinski force-pushed the vpi-preload-fetchpriority-high branch from 204a7c1 to ca5c225 Compare June 5, 2026 09:45
@timotei-litespeed

Copy link
Copy Markdown
Contributor

Thank you :)

@maciejmrozinski

Copy link
Copy Markdown
Author

Thanks for reviewing this.

I've made both requested changes:

  • updated fetchpriority to use double quotes (fetchpriority="high")
  • changed the target branch from main to dev

Thank you for taking another look and for forwarding this to the development team.

@hi-hai hi-hai merged commit 3d48652 into litespeedtech:dev Jun 8, 2026
@timotei-litespeed

timotei-litespeed commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

@maciejmrozinski Changes have been added to dev branch. It will be released in the next versions of LSC(not sure which one, that's why I cannot tell you exactly).

Thank you! :)

@maciejmrozinski maciejmrozinski deleted the vpi-preload-fetchpriority-high branch June 8, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants