Optimize AMP
-
Hi, I’m using your plugin and a theme that I’m making following all the AMP.dev recommendations.
https://amp.dev/documentation/guides-and-tutorials/optimize-and-measure/optimize_amp/
Here it indicates several things… One of them is the preloading of the AMP v0.js file.
<!doctype html> <html ? lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <meta name="description" content="This is the AMP Boilerplate."> <link rel="preload" as="script" href="https://cdn.ampproject.org/v0.js"> <link rel="preload" as="script" href="https://cdn.ampproject.org/v0/amp-experiment-0.1.js"> <link rel="preconnect dns-prefetch" href="https://fonts.gstatic.com/" crossorigin> <script async src="https://cdn.ampproject.org/v0.js"></script> <script async custom-element="amp-experiment" src="https://cdn.ampproject.org/v0/amp-experiment-0.1.js"></script> <!-- Import other AMP Extensions here --> <style amp-custom> /* Add your styles here */ </style> <link href="https://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet"> <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible.selected}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible.selected}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible.selected}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible.selected}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible.selected}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> <link rel="canonical" href="."> <title>My AMP Page</title> </head> <body> <h1>Hello World</h1> </body> </html>
The strange thing is that the English version of the documentation does not show such an example and does not talk about it. But in the German, French, Spanish versions… Yes, it does. So, should I preload the v0.js or not, and if the answer is yes. Should I preload v0.js or v0.mjs? because as I see in chrome what is downloaded in the browser is the .mjs and not the .js?
Should I preload some of the other js that I use from AMP? like for example the cookie consent that is shown when you enter the website…?
Another question I have is regarding custom fonts.
<link rel="preload" as="font" href="/bundles/app/fonts/helveticaneue-roman-webfont.woff2" >
I want to preload it and put it as high as possible… After the first <meta> tags as indicated in the google documentation… But, if I put it in the header.php as high as possible, the AMP plugin moves the code further down… I have also tried adding a wp_head action with priority -9999 and it still puts it too low.
I am using AMP version on the whole website and not only for people coming from Google, so I would like to optimise it as much as possible.
Thank you.
- The topic ‘Optimize AMP’ is closed to new replies.