News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Accelerated Mobile Pages (AMP)

Started by nend, September 16, 2016, 12:34:52 AM

Previous topic - Next topic

nend

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.
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.

Arantor

If form isn't allowed, posting isn't going to work.

Neither is quick moderation, or logging in...

Antes

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.

nend

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

Arantor

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.

nend

Quote from: Arantor 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.

True, I forgot to take that into consideration.

nend

Search Console report shows increase in CTR over one month span.

rickey29

All,

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

Rickey

fazeMark

I am looking for a theme with AMP integrated. Are there any?

nend

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.

rumosdio

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

nend

Quote from: rumosdio 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

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.

rumosdio

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.

neoweb

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 :(

rickey29

Quote from: neoweb on November 23, 2017, 09:25:00 AM
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.

Dzonny


postpar

Forgive me for re-opening this, but the two links posted here are both dead. Have the projects been abandoned? AMP does make a difference and I would very much like to be able to use SMF with it.

Arantor

AMP makes a difference in that it's easier for Google to make money off your content.

A slightly acerbic (and a little hyperbole-laden) take on it - https://www.theregister.co.uk/2017/05/19/open_source_insider_google_amp_bad_bad_bad/

Though I have yet to see any evidence that this quote is wrong:
QuoteGoogle AMP is a Google project designed such that you must restrict your layout options, forgo sending visitors to your website and accept whatever analytics data Google is willing to share.

It's also fairly good at discouraging people from responding to posts on your forum...

Xpresskonami

Please we need AMP for SMF. About 70% Amp now index on SEO. Any mod for this please

Saiy


Advertisement: