I have tried everything to get font-display to work for my Adobe Typekit font. I am still getting the error "Ensure text remains visible during webfont load" in google pagespeed insights. I can't find any forums for this specific issue.
The pagespeed insights error shows this link as the culprit:
I have made sure to select font-display: swap within my project in Adobe as seen here at this link:
https://use.typekit.net/wqe8olp.css
Within my functions.php file I am adding the font like this:
function add_typekit_fonts()
{
echo '<link rel="preconnect" href="https://use.typekit.net" crossorigin>' . "\n";
echo '<link rel="preload" as="style" href="https://use.typekit.net/wqe8olp.css">' . "\n";
wp_enqueue_style('typekit-fonts', 'https://use.typekit.net/wqe8olp.css', array(), null, 'print');
echo '<noscript><link rel="stylesheet" href="https://use.typekit.net/wqe8olp.css"></noscript>' . "\n";
}
add_action('wp_head', 'add_typekit_fonts');
And lastly, adding it to my CSS
@font-face {
font-family: 'sofia-pro';
src: local('sofia-pro'), url(https://use.typekit.net/wqe8olp.css?family=sofia-pro&display=swap);
font-display: swap;
}
Still getting the same error.
I am not sure what else I could possibly do. I know with google fonts there is a URL attribute to add it within the link itself, but have had no luck finding any information on this for Typekit fonts. What am I missing?