{"id":38518,"date":"2016-07-29T12:49:55","date_gmt":"2016-07-29T07:19:55","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=38518"},"modified":"2016-07-29T12:49:55","modified_gmt":"2016-07-29T07:19:55","slug":"amp-accelerated-mobile-pages-by-google","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/amp-accelerated-mobile-pages-by-google\/","title":{"rendered":"AMP- ACCELERATED MOBILE PAGES by Google"},"content":{"rendered":"<p>Now-a-days, if anyone browse a website on mobile, everyone expect rich and HD graphics, smooth scrolling, fast animations, transitions to load quickly. Google introduces a new technique known as AMP. It\u2019s a technique to build static content web pages that render fast. Its basic structure consists of three different layers:<\/p>\n<ol>\n<li>AMP HTML: HTML extended with custom AMP properties but with some restrictions for fast and reliable performance<\/li>\n<li>AMP JS Library: ensures the fast rendering of AMP HTML pages<\/li>\n<li>Google AMP Cache: used to serve cached Amp HTML pages<\/li>\n<\/ol>\n<p>So AMP Project = AMP-HTML + AMP JS Library + Custom Styling + AMP Cache<\/p>\n<p>Goals of AMP Project<\/p>\n<ul>\n<li>Make pages fast<\/li>\n<li>Easy to implement<\/li>\n<li>Enable monetization<\/li>\n<li>Embrace open web<\/li>\n<\/ul>\n<p><strong>Create first AMP Page:<\/strong><\/p>\n<p>Basic structure for AMP Page is below:<\/p>\n<p>[java]<br \/>\n&lt;!doctype html&gt;<br \/>\n&lt;html amp lang=&quot;en&quot;&gt;<br \/>\n&lt;head&gt;<\/p>\n<p>&lt;\/head&gt;<br \/>\n&lt;body&gt;<\/p>\n<p>&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<br \/>\n[\/java]<\/p>\n<p>Code inside head tag:<\/p>\n<p>[java]<br \/>\n&lt;head&gt;<br \/>\n&lt;meta charset=&quot;utf-8&quot;&gt;<br \/>\n&lt;title&gt;First AMP Page&lt;\/title&gt;<br \/>\n&lt;link rel=&quot;canonical&quot; href=&quot;http:\/\/ampproject.org\/article.html&quot; \/&gt;<br \/>\n&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,minimum-scale=1,initial-scale=1&quot;&gt;<\/p>\n<p>&lt;style amp-boilerplate&gt;<br \/>\nbody{-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}<br \/>\n@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}<br \/>\n@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}<br \/>\n@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}<br \/>\n@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}<br \/>\n@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}<br \/>\n&lt;\/style&gt;<\/p>\n<p>&lt;noscript&gt;<br \/>\n&lt;style amp-boilerplate&gt;<br \/>\n  body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}<br \/>\n&lt;\/style&gt;<br \/>\n&lt;\/noscript&gt;<\/p>\n<p>&lt;style amp-custom&gt;<br \/>\n  amp-img.grey-placeholder {<br \/>\n   background-color: grey;<br \/>\n  }<br \/>\n&lt;\/style&gt;<\/p>\n<p>&lt;script async src=&quot;https:\/\/cdn.ampproject.org\/v0.js&quot;&gt;&lt;\/script&gt;<br \/>\n&lt;\/head&gt;<br \/>\n[\/java]<\/p>\n<p>Code inside body tag:<\/p>\n<p>[java]<br \/>\n&lt;body&gt;<br \/>\n   &lt;h1&gt;This is my First AMP Page&lt;\/h1&gt;<br \/>\n&lt;\/body&gt;<br \/>\n[\/java]<\/p>\n<p><b>Note:<\/b><br \/>\n&lt;!doctype html&gt; is required at the top.<br \/>\n&lt;html amp&gt; to tell browser that we are using amp.<br \/>\n&lt;link rel=&#8221;canonical&#8221; href=&#8221;_canonical-url_&#8221; \/&gt; it points to the regular HTML version of the AMP HTML document or to itself if no such HTML version exists.<br \/>\n&lt;script async src=&#8221;amp-js-library&#8221;&gt;&lt;\/script&gt; it includes AMP JS library.<\/p>\n<p><strong>Some extended HTML tags:<\/strong><\/p>\n<ul>\n<li>amp-img: replacement of HTML img tag<\/li>\n<li>amp-ad: container to display ad and a script is required<\/li>\n<li>amp-pixel: used to count the page views by typical tracking pixel<\/li>\n<li>amp-embed: used to embed elements<\/li>\n<li>amp-video: replacement of HTML5 video tag<\/li>\n<\/ul>\n<p><strong>Styling\/ Presentation<\/strong><\/p>\n<p>Styling is done by using common CSS, by using starting tag &lt;style amp-custom&gt;:<\/p>\n<p>[java]<br \/>\n&lt;style amp-custom&gt;<br \/>\n  body {<br \/>\n    background: white;<br \/>\n  }<br \/>\n  amp-img {<br \/>\n    border: 1px solid black;<br \/>\n  }<br \/>\n&lt;\/style&gt;<br \/>\n[\/java]<\/p>\n<p>Make sure there should be only one amp-custom style tag for styling. And even AMP page can have a single embedded stylesheet.<\/p>\n<p><strong>Validate AMP Page: <\/strong><\/p>\n<p>AMP is providing a validator built in browser only. No need to validate your code from other online validators. Just open your document in any browser through local server: XAMP\/WAMP.<br \/>\nAdd #development=1 after the url in address bar.<br \/>\ne.g http:\/\/localhost:8000\/first-amp-page.html#development=1<br \/>\nOpen Dev tool console in chrome browser and check validation errors.<\/p>\n<p>Congrats you have created first AMP Page and tested locally.<\/p>\n<p>You can explore more about this.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now-a-days, if anyone browse a website on mobile, everyone expect rich and HD graphics, smooth scrolling, fast animations, transitions to load quickly. Google introduces a new technique known as AMP. It\u2019s a technique to build static content web pages that render fast. Its basic structure consists of three different layers: AMP HTML: HTML extended with [&hellip;]<\/p>\n","protected":false},"author":231,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":1},"categories":[3429,1],"tags":[3830,398,3831],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/38518"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/231"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=38518"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/38518\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=38518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=38518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=38518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}