Advertisement:

Author Topic: Accelerated Mobile Pages (AMP)  (Read 4309 times)

Offline nend

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,755
  • 2 deep n2 the code
    • sicommnend on GitHub
    • SIComm.us
Accelerated Mobile Pages (AMP)
« on: September 16, 2016, 12:34:52 AM »
Today while browsing Webmaster Tools, I decided to look into AMP in more detail. I seen it before but it always thought I didn't need such a thing.

Will I decided to play around with it according to the standard and did a little buffer rewriting.
Code: [Select]
function amp_rewrite_buffer($buffer) {

// Allowed with formatting, this code needs to be better.
$ctamp = array('img','video','audio','iframe');
foreach ($ctamp as $item)
$buffer = str_replace('<'.$item, '<amp-'.$item, $buffer);

$doc = new DomDocument();
$doc->loadHTML($buffer);
$xpath = new DOMXPath($doc);

// Script is not allowed only if it is ld+json
while($node = $xpath->query('//script[@type!="application/ld+json" or not(@type)]' )->item(0))
$node->parentNode->removeChild($node);

// Not allowed elements
$remove = array('frame', 'frameset', 'object', 'param', 'applet', 'embed','form');
foreach($remove as $item)
while($node = $xpath->query('//'.$item)->item(0))
$node->parentNode->removeChild($node);

//button is allowed, no documentation on radio though.
$types = array('input','textarea','select','option');
foreach($types as $type)
while($node = $xpath->query('//input[@type="'.$type.'"]')->item(0))
$node->parentNode->removeChild($node);

// Send the doc from the dom back to the buffer
$buffer = $doc->saveHTML();

// We do this last for a reason.
$buffer = str_replace('</head>', '<script async src="https://cdn.ampproject.org/v0.js"></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></head>', $buffer);

return $buffer;
}
This doesn't render the page fully compliant and it doesn't look all that pretty without all that script and html charm that was removed.

After all, I was just thinking wouldn't it be easier just making a mobile template.  ::)

What are your ideas and opinions about AMP.
« Last Edit: September 16, 2016, 12:52:42 AM by nend »

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,032
    • Arantor on GitHub
Re: Accelerated Mobile Pages (AMP)
« Reply #1 on: September 16, 2016, 05:44:32 AM »
If form isn't allowed, posting isn't going to work.

Neither is quick moderation, or logging in...
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline Antes

  • Evil Black Cat
  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,646
  • Gender: Male
  • Black cat rulz!
    • Antes on GitHub
    • merta on LinkedIn
    • @antesistan on Twitter
    • Lunarfall
Re: Accelerated Mobile Pages (AMP)
« Reply #2 on: September 16, 2016, 07:55:10 AM »
Nope... http://www.xda-developers.com/accelerated-mobile-pages-what-are-they-and-how-do-i-implement-them/#index It requires too much for already established software, and I don't think it has huge difference compared to responsive. Another Google boosted project.
Active Project(s): [ SimpleDesk ] # [ Lunarfall ] # [ CoreStore ]

Past Project(s): [ ezPortal ]

Offline nend

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,755
  • 2 deep n2 the code
    • sicommnend on GitHub
    • SIComm.us
Re: Accelerated Mobile Pages (AMP)
« Reply #3 on: October 11, 2016, 09:59:26 PM »
I went ahead and implemented this a while back and looks like it does have some SEO benefits on Google on mobile. I didn't use the code I posted above and went the template route.

The page below and a screen shot of the search listing on mobile, beat Wikipedia for the search phrase.
http://www.sicomm.us/a/amp/?m=97

And here is a topic view.
http://www.sicomm.us/a/amp/?t=180

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,032
    • Arantor on GitHub
Re: Accelerated Mobile Pages (AMP)
« Reply #4 on: October 12, 2016, 03:27:30 AM »
You're also using personalised data which will also bias places you've already been above places you haven't been so much - as shown by the 'you went here on xxx' - which sort of makes it hard to use as evidence that, objectively, it improved things.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline nend

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,755
  • 2 deep n2 the code
    • sicommnend on GitHub
    • SIComm.us
Re: Accelerated Mobile Pages (AMP)
« Reply #5 on: October 12, 2016, 11:06:24 AM »
You're also using personalised data which will also bias places you've already been above places you haven't been so much - as shown by the 'you went here on xxx' - which sort of makes it hard to use as evidence that, objectively, it improved things.

True, I forgot to take that into consideration.

Offline nend

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,755
  • 2 deep n2 the code
    • sicommnend on GitHub
    • SIComm.us
Re: Accelerated Mobile Pages (AMP)
« Reply #6 on: October 31, 2016, 09:22:55 AM »
Search Console report shows increase in CTR over one month span.

Offline rickey29

  • Semi-Newbie
  • *
  • Posts: 14
Re: Accelerated Mobile Pages (AMP)
« Reply #7 on: December 19, 2016, 09:24:40 PM »
All,

Is there any AMP theme/template available for Simple Machines?  If not, is it a good idea to develop one?

Rickey

Offline fazeMark

  • Semi-Newbie
  • *
  • Posts: 10
Re: Accelerated Mobile Pages (AMP)
« Reply #8 on: December 30, 2016, 06:04:07 AM »
I am looking for a theme with AMP integrated. Are there any?

Offline nend

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,755
  • 2 deep n2 the code
    • sicommnend on GitHub
    • SIComm.us
Re: Accelerated Mobile Pages (AMP)
« Reply #9 on: December 30, 2016, 08:22:31 AM »
Sorry I was hoping someone would of picked this up as I released all the required source code to get this working.
http://www.simplemachines.org/community/index.php?topic=549622.0

If no one is interested, I will go ahead and put this together as a modification.

Offline rumosdio

  • Semi-Newbie
  • *
  • Posts: 27
  • Gender: Male
    • Vízszerelő Budapest
Re: Accelerated Mobile Pages (AMP)
« Reply #10 on: January 09, 2017, 04:26:32 PM »
smf AMP ;)

http://www. vizszerelo-budapest.hu/amp/amp-index.html

Akit esetleg érdekel magyar nyelven tudok instrukciókat adni, vagy elérhetőséget ahhoz aki csinálta, bár ehhez a készítő beleegyezése is kelleni fog majd

Offline nend

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,755
  • 2 deep n2 the code
    • sicommnend on GitHub
    • SIComm.us
Re: Accelerated Mobile Pages (AMP)
« Reply #11 on: January 10, 2017, 12:45:13 AM »
smf AMP ;)

http://www. vizszerelo-budapest.hu/amp/amp-index.html

Akit esetleg érdekel magyar nyelven tudok instrukciókat adni, vagy elérhetőséget ahhoz aki csinálta, bár ehhez a készítő beleegyezése is kelleni fog majd

Looks like you got it going. The only issue I can see is you have your canonical's pointing to the board index and not the actual topic. The AMP documents will be penalized for having mismatched content and possibly not indexed.

I had a similiar problem a few days ago. However in my case I believe Google happened to be browsing along on two occasions and caught error pages while I was uploading new sources to the server. It was only a couple of AMP documents and I have resubmitted them, so hopefully they'll be back up soon. See attachment below.

Offline rumosdio

  • Semi-Newbie
  • *
  • Posts: 27
  • Gender: Male
    • Vízszerelő Budapest
Re: Accelerated Mobile Pages (AMP)
« Reply #12 on: January 10, 2017, 01:18:12 AM »
custom development.

It has been modified in the comments.

AMP generated from the data in the file.

We do not deceive Google, but ordinary AMP is generated.

---------------------

by google translate

egyedi fejlesztés.

a hozzászólások lett módosítva.

onnan generálódnak az adatok az AMP fájlnak.

Nem becsapjuk a google-t, hanem rendes AMP van generálva.

Offline neoweb

  • Semi-Newbie
  • *
  • Posts: 68
  • Gender: Male
  • Neoweb.nl Wetenschaps forum
    • https://www.facebook.com/neoweb.nl on Facebook
    • Neoweb.nl Wetenschaps Forum
Re: Accelerated Mobile Pages (AMP)
« Reply #13 on: November 23, 2017, 09:25:00 AM »
I want to use AMP on my forum ( https://www.neoweb.nl/forum2 ) but how do I implement it?
Google is also suggesting using an AMP plugin for wordpress... but SMF =! Wordpress :(

Offline rickey29

  • Semi-Newbie
  • *
  • Posts: 14
Re: Accelerated Mobile Pages (AMP)
« Reply #14 on: November 23, 2017, 07:10:00 PM »
I want to use AMP on my forum ( https://www.neoweb.nl/forum2 [nofollow] ) but how do I implement it?
Google is also suggesting using an AMP plugin for wordpress... but SMF =! Wordpress :(
Look like a AMP SMF plugin is necessary.

Offline Dzonny

  • Lead Localizer
  • SMF Super Hero
  • *
  • Posts: 11,603
  • Gender: Male
  • No sleep...
    • dzontra.nikola on Facebook
    • Dzonny on GitHub
    • dzontranikola on LinkedIn
    • @opusteniforum on Twitter
    • Samo opusteno
Re: Accelerated Mobile Pages (AMP)
« Reply #15 on: November 23, 2017, 07:39:25 PM »