Getting Started With AMP (Accelerated Mobile Pages)
Written by David Ugale Published on 4/22/2019
WHAT IS AMP?
Accelerated Mobile Pages (AMP) is an Open Source framework used to create faster loading mobile web pages. AMP pages are built using AMP HTML, a subset of HTML. Although similar to regular HTML, AMP HTML has required markup, unique tags, and other restrictions that make it different than regular HTML. In addition, third-party JavaScript is not allowed and custom CSS must be used inline.
SEARCH ENGINE RANKINGS
Page speed is now a ranking factor in Google mobile search results. Consequently, having a fast-loading mobile website has the potential to help your website rank higher. Although using AMP specifically may not improve your search engine rankings, by using the AMP framework, your mobile pages will be optimized to load faster in mobile.
In Google's mobile search results, AMP pages will appear with a next to them:
AN AMP HTML TEMPLATE
Below is a sample AMP starter template with all of the required markup:
Note: you can use amp in place of ⚡. Example: <html amp lang="en">
For a quick start to creating your own AMP pages, you can follow this tutorial. You can also try the AMP Boilerplate Generator.
COMMON AMP TAGS
In place of the <img> tag, you would use the <amp-img> tag:
Note: AMP requires that all elements have an explicit size. For example, images included on an AMP page will need to have height and width values set for that element.
AMP STYLES
AMP pages can be styled using CSS, but only inline. CSS properties are placed in an embedded stylesheet within a <style amp-custom> tag in the <head> of the web page.
Example:
In order for your AMP pages to be crawled and indexed by Google, your AMP pages must link to a canonical page. The canonical page can either be a non-AMP page or the AMP page itself.
If you have a non-AMP page and an AMP page:
On the non-AMP page, you need to specify the AMP version of the page using rel="amphtml":
There are several ways to validate your AMP pages. You can validate your AMP pages by going to the AMP Validator and entering your AMP page URL:
The AMP Test tool will check if your AMP pages meet Google Search Requirements
If you use the Google Chrome Web Browser, you can use the Chrome DevTools console to validate your AMP pages:
Open your AMP page in the Google Chrome Web Browser
Append #development=1 to the URL in the address bar. Example: https://www.dayaweb.com/blog/http-to-https-migration-checklist/amp/#development=1
Open DevTools to check for any errors
AMP TIPS
Use HTTPS. There are certain AMP features that require HTTPS, but there are many reasons why your website should be using HTTPS.