Hello @zotezo
Thank you for the support topic, as we mentioned in a similar support topic you previously created
You can ignore that. It’s obsolete. See https://github.com/ampproject/amp-toolbox/issues/1255
Thread Starter
zo
(@zotezo)
How can I ignore as due to this My Pagespeed Score decreases and Page Experience also not good.
@zotezo
Please add the following code in your active themes functions.php or in a custom plugin
/**
* Preload AMP runtime scripts.
*/
function amp_preload_amp_runtime() {
echo sprintf( '<link as="script" href="%s" rel="preload" crossorigin="anonymous">', esc_url( 'https://cdn.ampproject.org/v0.js' ) );
echo sprintf( '<link as="script" href="%s" rel="preload" crossorigin="anonymous">', esc_url( 'https://cdn.ampproject.org/v0.mjs' ) );
}
add_action( 'wp_head', 'amp_preload_amp_runtime' );
add_action( 'amp_post_template_head', 'amp_preload_amp_runtime' );
Hope this helps!
I would omit this:
echo sprintf( '<link as="script" href="%s" rel="preload" crossorigin="anonymous">', esc_url( 'https://cdn.ampproject.org/v0.js' ) );
It’s only relevant to IE11 visitors.
For preloading v0.mjs, it should probably be a modulepreload link instead of a preload one.
Nevertheless, we found that the preload actually slows down rendering so we removed it in https://github.com/ampproject/amp-toolbox-php/issues/17
See my findings:
https://github.com/ampproject/amp-wp/issues/6182#issuecomment-865363567
https://github.com/ampproject/amp-wp/issues/6182#issuecomment-867333175
@zotezo
As we didn’t receive a response I’ll mark this as resolved. Feel free to open a new support topic if you require any further assistance.