-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add preconnect resource hints for more components #10
Comments
This would only make sense if we could verify that a component is used in the first viewport. Otherwise, it should be left up to the theme/plugin author to do manually. |
@sebastianbenz How about extending the use of So given an HTML page that contains (note the <amp-youtube
data-videoid="mGENRKrdoGY"
layout="responsive"
width="480"
height="270"
data-hero
></amp-youtube> The new optimizer transformer could add these <link rel="preconnect" href="https://s.ytimg.com">
<link rel="preconnect" href="https://i.ytimg.com"> These are the two URLs that are being preconnected in the component: https://github.com/ampproject/amphtml/blob/01ba647457f8e12f9f7e0a5a23fb72d28c6e63f4/extensions/amp-youtube/0.1/amp-youtube.js#L116-L128 This would require looking over each AMP component to build up an index mapping component name to preconnect URLs. Should adding such preconnect links should be restricted to components that have |
Good idea! I think we should add YouTube to the automatic hero detection as well. This would also make the heuristic more reliable, as an |
The same logic being used for |
When running a Lighthouse audit on an AMP page that contains an
amp-youtube
component in the first viewport, I saw a “Preconnect to required origins” warning:While AMP components already do
preconnect
in themselves, they do so after the component script has loaded and ran. If we addrel=preconnect
resource hint links to pages that haveamp-youtube
elements automatically, then we could shave some additional milliseconds and improve the Lighthouse score.The text was updated successfully, but these errors were encountered: