
Here is sample Page
<!doctype html>
<html amp lang="en">
<head>
<meta charset="utf-8">
<title>My First AMP Page</title>
<link rel="canonical" href="http://www.acesoftech.com/regular-version" />
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "NewsArticle",
"headline": "Learning AMP Features",
"datePublished": "2016-10-12",
"image": [
"thumbnail.jpg"
]
}
</script>
<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}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
<body>
<h1>Welcome to my First AMP Pgae</h1>
</body>
</html>
Here is anatomy of the code
- AMP Document must with the doctype <!doctype html>. Same like HTML5.
- And then <html amp lang=”en”>. Where it says en, you can place any language.
- Must have <head> and <body> tags (They are not compulsory in HTML).
- Inside head section you must place canonical attribute. <link rel=”canonical” href=”regular-html-version.html” /> . If there is no regular version of HTML, then you can place same AMP page.
- Mus place a <meta charset=”utf-8″> tag as the first child of their head tag.
- And to make it all device friendly viewing (Particularly,IOS device ) must add
<meta name=”viewport” content=”width=device-width,minimum-scale=1″> inside head tag. And remember, initial scale must be 1. - Also must have a <script async src=”https://cdn.ampproject.org/v0.js”></script> tag as the last element in their head.
- Must contain the following in their <head> tag: <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}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
How to insert Image in AMP
As you know without image our web pages are nothing, along with text, we need to express our thoughts and opinions with images also. In Accelerated Mobile Pages there is separate tag for image.
Below is the example of how to insert Image in our AMP web pages.
<amp-img src="cricket.jpg" alt="cricket image" height="400" width="800"></amp-img>
Adding custom CSS in AMP
Like normal HTML page,AMP pages also can be styled-up and can be made retina friendly.You can also add CSS in your AMP page.
Below is the sample code :
<style amp-custom>
h1{
background-color: white;
}
amp-img {
background-color: yellow;
border: 1px solid blue;
}
</style>
How can I embed video in AMP
You can embed youtube video in your AMP page. Not only that, you can also
<amp-youtube data-videoid="SqT0glwuYYo" layout="responsive" width="480" height="270"> </amp-youtube>
AMP FAQs
What is the validation process of AMP html code?
You can validate your AMP web page to know if its compatible with the rule of AMP or not.
1. Open your page in your browser and add “#development=1” to the URL,
for example http://localhost/first.amp.html#development=1.
Now, to check open Chrome DevTools console and check for validation errors.
You will see something like this.

How can we call AMP html pages in normal HTML page?
There are few websites which if you open it redirects to mobile page. AMP pages are something like that. You can refer your AMP HTML pages in normal HTML pages.
Using link rel tag we can call any AMP HTML pages.
Example :
<link rel=”amphtml” href=”http://www.acesoftech.com/amp-web-design”>
How we can tell browser if regular version of AMP HTML exists
As you know if there is any duplicate content inside your website then it
penalizes your website for duplicate content.To avoid duplicate content penalty, you can use ‘canonical’ to tell Search Engine that the full-fledged HTML page is different.
<link rel=”canonical” href=”my-regular-page”>
What is the SEO advantage of AMP HTML
Since arrival of Google’s much hyped ‘Mobilegeddon’ algorithm in February 2015. According to that, if your web page is not mobile friendly then google would down in the ranking of the web page in Mobile search. Since then Google is constantly working on different mobile rendering technique services.
And as you know, Google has always rewarded the website which loads faster as compared to those websites which loads very slow.
Example:
<amp-ad width="300" height="200" type="adsense" data-ad-client="ca-pub-1234560123456" data-ad-slot="1234567890"> </amp-ad>
How can we insert Analytics code as per AMP code ?
Almost every website owners add analytic s code for visitor’s tracking. If you want to integrate analytic’s code as per AMP , below is the sample code
Example:
<amp-ad width="300" height="200" type="adsense" data-ad-client="ca-pub-1234567890123456" data-ad-slot="1234567890"> </amp-ad>