How Google AMP works for WordPress Websites

Google Amp

WordPress is an amazing platform that provides exceptional ease to people from all backgrounds. Coder or no coder, you can build your site within a short span of time. By integrating AMP with WordPress, website owners can enjoy and provide their users a unique experience.   

So what is AMP?

AMP (Accelerated Mobile Pages) is an open standard project, initiated by Google, that allows quick loading of pages on mobile devices. Google gives special preferences to AMP pages. This allows them to enjoy higher rankings, load in as less time as one second and use data less than ten times as compared to regular pages.

AMP is based on HTML with few restrictions and some specialized tags. AMP pages can be built by creating a separate version of the respective site, based on AMP standards.

HTML AMP can be rendered easily similar to normal HTML.  Apart from creating website, this open source HTML framework allows you to create AMP ads, AMP stories and even AMP emails.

To maintain the performance, AMP has a list of elements that are restricted or has replacement. You can learn more about them here : https://amp.dev/documentation/guides-and-tutorials/learn/spec/amphtml/?format=websites

Clearly, AMP has turned out to be extremely beneficial for content creators.

How to use AMP for WordPress:

  • Install the WordPress Plugin: Install the official AMP plugin from the link below:
     https://amp-wp.org/

    After installation, make sure that you disable “AMP” on each page individually and then start activating and fixing one page at a time. This will allow you to manage pages easily.

amp
  • Understanding the modes: AMP basically creates another light weight version of pages and creates a canonical URL such as:

    Non-AMP URL: abc.com
    AMP URL : abc.com/?amp

Now let’s see what modes provide us

  • Standard : The standard mode converts all pages in AMP as soon as you activate it and there will be no canonical URLS. So your site is just amp overall. This may require development work if your theme styles break.
  • Transitional: This mode will allow you to manage both URLs: AMP and non AMP. This way you have styles and other important functions in your hand. You can keep everything on the page to be displayed on desktop (Non-AMP), while managing what to show/hide in the AMP version for mobile view.
  • Reader : Reader mode also have both AMP and non-Amp version but here your theme for site is not used. It converts page into a very simplified template.
  • -Managing styles/scripts for AMP version pages: If you choose Standard or Transitional mode you will need some development work as mentioned before. Here are few important points to consider: 

  • All styles and scripts need to be in header file inside the head tag.
  • Styles should be placed between <style amp-custom> </style> tags.
  • There are few actions on page that need scripts like slick slider, hamburger menu etc. You will need to check if they have replacement in amp. If yes, then replace, for example : slick slider with amp carousel and hamburger menu with amp-sidebar.
  • If there is Google captcha on your forms, you will have to enable option for the captcha keys to work with AMP. Login to the Google recaptcha account and check this option :

    google-captcha

  • You will need a condition to get the new AMP related styles work only on amp page. So here is what you will add :

if (function_exists( ‘is_amp_endpoint’ ) && is_amp_endpoint()) {

    // do stuff }

For more details read here :

Submitting the page on Google: The last step after setting the styles and scripts for amp page is to get the AMP version of URL crawl by Google.

For this, login to the Google search console and submit the page URL for indexing. After few hours the result will be emailed to you, if there will be amp related errors the result will display them and you will have re-indexed the page, once they are fixed.

How AMP Works so Fast? 

Let’s discuss some of the reasons that makes AMP to work so fast:

  • Javascript is a powerful method to modify a page but it can create delay in page rendering. AMP helps to deal with this issue by only allowing asynchronous JavaScript.
  • Custom AMP elements, though consisting of some JavaScript, are designed in a way that they do not affect the overall performance.  
  • All external resources (such as ads or iframes) are supposed to define their size in HTML. AMP does not wait for the resources to download and loads the layout of the page.
  • If a page is using custom script, then it is necessary to let the AMP system know that it will have a custom tag.
  • AMP Pages does not restrict Third party Javascript provided it is specifically for sandboxed iframes.
  • AMP HTML only allows inline styles, while the inline style sheet provides a maximum size of 50 kilobytes.
  • AMP allows GPU-accelerated animations i.e. animation and transitioning can be done on transform and opacity which eliminates the need of page layout.    
  • AMPHTML allows you to share your ads on AMP and non-AMP pages. In short, you can create and share your adds, without any hassle, on any platform.
  • AMP also optimizes resource download. It does so by prioritizing the resource loading. And only loads the relevant, most necessary resources and prefetches the lazy-loaded resources. It loads the resources by taking ample amount of time while prefetches them without showing any delay.
  • As far as ads and images are concerned, they are only downloaded based on the user’s interest.
  • When prerendering is applied to web content, it utilises a lot of bandwidth as well as CPU. AMP greatly helps in resolving such issues too.

What is CSS Tree Shaking?

CSS Tree Shaking : AMP purpose is to keep pages as simple as possible. Tree shaking is an algorithm that removes the css that is invalid for AMP page and exceeds limit of 50 KB. Your styling may break after converting pages. To fix this you will have to do some custom css in the header file. To read more, click here 

https://amp.dev/documentation/guides-and-tutorials/develop/style_and_layout/style_pages/

Conclusion

The quick loading of AMP pages plays a vital role to create and maintain a large audience. This expands user engagement, brand awareness and enhances their interest in purchasing your product.

You can customise CSS any way you want along with performing A/B testing to provide an appealing website to viewers. Since you are providing fast access to every single page, it also helps in increasing the revenue.

By building website content (such as ads or landing pages) through AMP, which usually takes time, you can distribute them on various platforms simultaneously.

You do not even have to optimize your code for every distribution platform as format of AMP is completely portable and fast. Undoubtedly, Google AMP has changed the way content is loaded and accessed.

Would you like to hire us for any of the following services?

Simply complete the form below and we'll call you for a free evaluation.

By clicking on this button, you give consent to the processing of your personal data and agree to Genetech Solution’s privacy policy.

At Genetech we pride ourselves with our 'open communication' approach with our clientele. Once you initiate a project with us, be it big or small, our team will provide regular updates, regarding project status. We encourage our clients to interact with us as much as possible; so that we can deliver exactly you're looking for. As a team, we put in a lot of dedication and finesse into everything we create with you, so that you're thoroughly pleased with the outcome. As we begin all our projects from scratch, each plan is molded to most efficiently accomplishing it purpose. Backed up with solid coding and fresh designs, our work aims to impress. Finishing off with a strenuous QA run, all work is built to function smoothly.

Some from Our Clients

We couldn’t be happier with Genetech. Their creative team always delivers beyond our expectations and the development team hasn’t missed a deadline yet. Highly recommend.

Matthew Dearing

CEO, Dearing Studios
The following two tabs change content below.

Rabia Asif

Rabia Asif is a Project Manager at Genetech Solutions with a love for technology writing. Having a BS degree in Computer Science, she has decent exposure to, as well as makes ample effort to keep up with, latest technology trends.