1. Create a separate version of your main page by using AMP HTML (also known as the AMP version of your main page). Basic code for designing your first AMP HTML page is provided below:
<!doctype html>
<html amp lang=”en”>
<head>
<meta charset=”utf-8″>
<title>The title of your AMP page will go here </title>
<link rel=”canonical” href=”URL of the non AMP version will go here” />
<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”: “Open-source framework for publishing content”,
“datePublished”: “2015-10-07T12:02:41Z”,
“image”:
[
“logo.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 AMP</h1>
</body>
</html>
2. In order to insert images, use the following code:
<amp-img src=”welcome.jpg” alt=”Welcome” height=”400″ width=”800″></amp-img>
3. Modify the presentation and layout of the page by using common CSS properties. An example styling code is provided below:
<style amp-custom> /* any custom style goes here */ body { background-color: white; } amp-img { background-color: gray; border: 1px solid black; }</style>
4. Preview, validate and publish the AMP page.
5. Add the amphtmltag in the non-AMP version of the page in order to help search engine bots to identify the AMP version of your webpage:
<link rel=”amphtml” href=”AMP version of your webpage goes here” />