AMP posts – tips, technics and when to use

Last month we had very important fact – first time in history, mobile web had more unique visits that web. I guess, this trend will continue. This is why we want to keep this year for more advanced mobile support for all our products. And first major update is AMP advanced support.

AMP – is accelerated mobile pages technology which makes your mobile pages very fast. Don’t want to overload you many technical details, so, in simple words, AMP is like separate light version of your site special for mobile gadgets. You can find much more details about AMP here

There are many cases, when AMP will be bad sollution for your site. AMP has another ways to use scripts and styles, media, so, if you have too much important dynamic functions on page, AMP will be not your choice. If you have something important inside sidebar – you should also know that AMP doesn’t load sidebar at all. Sometimes you can solve this with adding any button in head of article, something like “Rate and compare here” which will redirect user to default web page.

If you decided to use AMP, here our article how to use it in our themes.

First of all, you need to install default AMP official plugin for wordpress. Go to Plugins – Add new and search plugin AMP, install and activate plugin

You have two further ways: use default theme options for advanced setup or use supported plugin Accelerated Mobile Pages (also free)

There are some pros and cons of each way. Using default theme option will give you maximum freedom for using advanced technics, and AMP modules (check below for some common examples). Using additional plugin is more easy for setup, but you will be limited by plugin’s modules, also, additional plugin is more load on site and can have more bugs. You can try both ways anc choose best for you, I will describe settings for both ways.

If you use Custom plugin for AMP with theme, you may have issue of too big css styles. AMP doesn’t support more than 50kb of css styles. If you have such issue, you can disable custom amp css in Theme option – AMP – Disable default amp styles of theme

Styling and fonts

Theme has some advanced ready styles for next parts: Content Egg and Affiliate Egg output, buttons, boxes shortcode, review block, title boxes, table of contents list, highlights, pros and cons block, user reviews, post offer section. You can add also own custom styles for AMP in Theme option – Mobile & AMP – Custom styles. You can also add there Logo for AMP version (if you use Accelerated Mobile Pages plugin, add logo in AMP – General). You can also set color for header in Appearance – AMP. Don’t forget to set your site icon if you didn’t have it in Customizer – Site Identity

I don’t recommend you to use Black design scheme in settings as it doesn’t fit for content blocks

Fonts

To make pages more fast, AMP version doesn’t have custom fonts as on web version. AMP plugin adds custom font Merriweather. To remove this font and add your custom font, do next steps:

  1. Disable default font in Theme option – Mobile & AMP
  2. Add link on any custom font in Theme option – Mobile & AMP – Header section. AMP supports only Google Fonts, Fonts.com, Font Awesome, Typography.com. I recommend to use Google fonts Just choose font and copy it’s link. Example.

Also, you need to overwrite default styles. To overwrite default body fonts, add next code to Theme option – Mobile & AMP – Custom css

where Arsenal is name of font. To overwrite headings, buttons, use code

Fallback link to web version

By default, AMP version will show number of comments, likes, review, but user can’t make any dynamic actions on AMP pages, so, it’s better to show him additional button to web version where he can do any actions with article. Usually, I use next code in section Theme option – Mobile and AMP – Before content

this code will show special button under title before content

Instead “white” class, you can use green, gold, brown, black, teal, blue, orange, purple, rose

Instead of “medium” class, you can use big, small to make button more big or small

Analytics ans statistic

As I wrote early, AMP is like separate mobile application of your site, so, all scripts from main site will not work on AMP. Also, AMP technology requires different way to add any scripts on page, including analytics code. You can find examples of add analytics code here

If you use additional recommended plugin, you can add Analytics in AMP – Gettings started – General

If you want to add manually, you can add next code

inside Theme option – Mobile and AMP – Header section

and next code to Theme option – Mobile and AMP – Footer section

replace Your_Analytics_ID to your ID. This is most simple settings for Analytics which tracks page views, you can check docs and find many different examples for setting different triggers.

Ads blocks on AMP

Ads on AMP has also another way to integration. If you use Accelerated Mobile Pages plugin, you can add ads blocks in AMP – Gettings started – Advertisement

You can also create your own ads blocks and insert them in one of sections in Theme option – Mobile & AMP. To do this, include first next code in Theme option – Mobile and AMP – Header section

Then, insert ads code in one of section in Theme option – Mobile & AMP. To see all available ads and examples, check this article about Ads on AMP. Example of Adsense code

Sticky ads

You can also add sticky ads with the same logic. Check this tutorial about sticky ads on AMP

Seo settings

Currently, theme supports Seo By Yoast plugin for AMP. Also, there are many other plugins which can add some basic seo settings for AMP, but we recommend to use Seo By Yoast

Social share button

We also added some share buttons. They are enabled by default. Facebook share requires app API key, you can set it in Theme option – Mobile & AMP. You need to register your FB application here

AMP for pages

I strongly recommend to disable pages for AMP support. This is because many plugins require some system pages and they will not work on AMP or make conflicts. Also, home page can have some post modules, which doesn’t have support for AMP. So, disable pages for AMP in AMP – General. Enable them only if you don’t have any custom pages with page builder and you have simple blog.

How to test AMP.

After all settings, it’s good to test your posts in AMP validator Just place link to your post and add in the end /amp. Example: http://site.com/post-url/amp

 

AMP posts – tips, technics and when to use
4.1 (82.61%) 23 votes

Want to get unique wordpress tips?

We won't rent or sell or spam your email. We promise!

42
Leave a Reply

avatar
21 Comment threads
21 Thread replies
5 Followers
 
Most reacted comment
Hottest comment thread
20 Comment authors
Asjad Noorwpsouladminyudi cahyadiEgbuachor Anthonywpsouladmin Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
TheShoppinggate
Guest

Hi, thanks for the update… there are other plugin should installed it’s
https://wordpress.org/plugins/glue-for-yoast-seo-amp/

tongercore
Guest

Wow, nice job !!!

mailhef
Guest

Thanks a lot, all AMP errors have disappeared !! just one question, menu is not showing on AMP pages anyway to fix it?

Martin
Guest
Martin

I am using the Rehub theme and I have installed the default AMP official plugin. I have put adsense code in the footer section and that works fine when I am visiting my AMP webpage using a mobile phone.

But when I also put the same Adsense code in After content section or Before content section, nothing happens. No ad shows up when visiting the same webpage. Do you know a solution for this?

Simone
Guest

I installed the AMP plugin (from Automattic) but I cannot find the AMP – General section (to disable AMP for pages). Where is it?

go1digital
Guest
go1digital

getting error in validation ..
Invalid URL protocol ‘http:’ for attribute ‘src’ in tag ‘img’. Learn more.
The tag ‘img’ may only appear as a descendant of tag ‘noscript’. Did you mean ‘amp-img’?

but some of the images are converted to amp-img but some are not..

Vijay
Guest
Vijay

Their is validation problem in Full Width Content egg (beta) module.
snapdeal logo images is failing validation which is in sidebar. flipkart is passing but dowsnot display logo in AMO

Jeff
Guest
Jeff

Are any of the demos setup to use amp?

Anna
Guest
Anna

Hello,

I wonder if I should use at the same time AMP and AMPforWP Accelerated Mobile Pages with a “structurated data” plugin such as Schema plugin:
https://wordpress.org/plugins/schema/

My purpose is making my website more SEO/human friendly, both on desktop and on mobile.

Those 3 plugins are compatible amongst them and good for such a purpose?

Thank you in advance for your reply.

Anna

wpsouladmin
Guest
wpsouladmin

second plugin can’t work without first. third plugin useless for amp version of site. amp plugin already has schema markup. for seo – read https://wpsoul.com/optimize-seo-wordpress/

Cappersinfo.com
Guest

The URLs are working for the amp pages, but how do I get Google to index/recognize the amp pages? They don’t seem to be getting added to my Yoast SEO sitemap. They also aren’t getting cached by Google.

Duc Nguyen
Guest

Amazing, thanks

yogesh
Guest

Hi admin,
Thanks a lot for the tutorial. I was looking for it from a very long time.

Marty
Guest

Extremely helpful. I’ve been wanting to learn more about this!

Fabio Schenone
Guest

Hi !
I’m using rehub/rewise with content egg . lazy loading images is turned on , AMP posts doesn’t show any product images it uses this instead : /wp-content/themes/rehub/images/default/noimage_336_220.png

Is there a fix ?
thanks !

Abhijeet
Guest

I think I have to switch to amp pages, They look ugly though

Egbuachor Anthony
Guest

i noticed a Credit link back to wordpress on the footer of amp pages, what if i want to remove “powered by wordpress”?

Pierre
Guest
Pierre

Hi,
Just for say, Rehub it’s not compatible with AMP for WP.

But it work with AMP for wordpress and Better AMP.

I deactivate default amp styles of theme but nothing change.

Egbuachor Anthony
Guest

Hello admin, I noticed that related posts are not displayed on amp pages. Is there a way to show related posts?

wpsouladmin
Guest
wpsouladmin

It’s depending on plugin which you use in AMP. check settings of plugin

Egbuachor Anthony
Guest

If I use Amp plugin by Automatic, it doesn’t display menu and related posts. Is there any way to add this function? Or should I try another plugin?

yudi cahyadi
Guest

after installing the amp plugin by automatic, some posts have error messages on the webmaster or other test tools. how to fix this

link example : https://yudionline.com/harga-samsung-galaxy-j7-duo/

thanks….

Asjad Noor
Guest

As always brilliant, you make it all make sense!! Thanks for the detailed article.