Outputting for AMP pages

So i’ve been reading about AMP and thinking through how i’d need to do it. Each of my pages is stored in a mysql database (nothing unusual there) and edited via a rich text editor. The editor is useful in that for images for example, it puts the height and width as styles rather than old school html. ok so far…

But AMP now seems to turn it around and want height=X and width=Y and will throw an error if you put inline styles. So i will have to remove these.

Will it kill my site speed to do str_replace and/or preg_replace to look for certain tags and replace on every page it serves? Is that the best way to do this?

I have a similar PHP Framework site with the pages stored in a MySql database. The site started as a hobby about ten years ago - long before mobiles became popular!

I adopted an image size of 555px wide that suited most popular screen at the time… and later had to laboriously edit the pages that failed the Google Mobile Friendly Test. The Kludge was to add style="width:88%; max-width:555px;". Eventually I managed to clear all discrepancies and every page was Mobile Friendly!!!

A couple of months ago I globally applied the AmpProject standards and broke thousands of pages; mostly due to the included image style. Fortunately using the Framework I was able to detect (and define a CONSTANT) if a page had an included image SQL: ... WHERE field LIKE %src%. If the CONSTANT is FALSE include a common AmpProject Header file ELSE include the old tried and tested header file. Pages that conform have respective labels of “Accelerated Mobile Page” or “Has Picture”.

I have just checked and according to Google Webmaster Tools I now have 2,655 Indexed AMP pages136 AMP pages with errors

It has been a slow and tedious process clearing the errors but well worth the effort because, once again according to Google Webmaster Tools my Search Analytics Average Page Position has dropped from about 11.5 to 7.2. This is mostly due to the average Mobile pages at 5.8.

I would certainly recommend trying the AmpProject and create some test pages with a No-Follow and No-Index Meta Tag. Pick an AmpProject Template, ensure conforms to Google’s new validation tester then gradually insert data from an existing page. There is a lot to be learnt because W3.org Standards are not used :frowning:

thanks for that. I think i’ll have a go and see how it performs. As you say there seems to be a lot of learn that seems counter intuitive.

interesting to know you got some good page position movement on the SERPs.


1 Like

so i was thinking and is there a need to put amp pages into your site map? I know that you should put the link in the top of the html page linking it across but didn’t know if there was an advantage to put them in the site map


If it’s just an AMP version of the same page, I would not think not, you would just use the canonical urls in the sitemap and have them linked as per the guidelines.

1 Like

I am not sure about your question.

As far as I understand existing web-page names will remain the same, only the additional AmpProject information will be added to the page. Most likely conflicts will arise because of Google’s new implementation of the existing W3.org specified img, styles, javascript, json, etc

It takes a lot of thought (and trial and error) to detect whether a web-page is to be AmpProject Specific to replace existing headers.

i was assuming that i’d have say www.example.com/page and perhaps www.example.com/amp/page or a subdomain like amp.example.com/page
so i didn’t know if it would be an advantage to have them in the site map too.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.