Description
Feature Description
When the LCP element is text, the loading of the font being used should be prioritized. For example, on one of my blog posts (using the Twenty Twenty theme), the LCP element is an h1
. It has a font-family
style of:
"Inter var", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif
The Inter var
font is loaded via this stylesheet:
<link rel="stylesheet" id="twentytwenty-fonts-css" href="https://weston.ruter.net/wp-content/themes/twentytwenty/assets/css/font-inter.css?ver=2.6" media="all">
The @font-face
rule is:
@font-face {
font-family: "Inter var";
font-weight: 100 900; /* stylelint-disable-line font-weight-notation */
font-style: normal;
font-display: swap;
src: url(../fonts/inter/Inter-upright-var.woff2) format("woff2");
}
The font-inter.css
stylesheet is already loaded with highest priority, but the font file is not in the critical path so it is not discovered until after the critical CSS is parsed:
To improve performance, this font file should be getting loaded sooner by adding this link:
<link rel="preload" as="font" href="https://weston.ruter.net/wp-content/themes/twentytwenty/assets/fonts/inter/Inter-upright-var.woff2" fetchpriority="high">
This allows the font file to start loading the same time as the font-inter.css
stylesheet:
And this will improve LCP.
Note that h1
is LCP element 5% of the time on mobile, with h2
and h3
being 2% and 1% respectively. The p
element is the LCP element 9% off the time on mobile.
Metadata
Metadata
Assignees
Type
Projects
Status