News:

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

Main Menu

AMP4SMF

Started by Antes, July 27, 2020, 04:43:04 PM

Previous topic - Next topic

Antes


Xpresskonami

Quote from: Antes on August 21, 2020, 02:52:32 PM
Yes

Thanks for the mod. Is this working with pretty url and how can i get the link for it

Xpresskonami



-Rock Lee-

Quote from: Xpresskonami on August 26, 2020, 11:41:27 PM
Thanks for the mod. Is this working with pretty url and how can i get the link for it

I use it with the pretty urls without problems, just add at the end "?action=amp"


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Antes

You don't need any URLs, by default Google will detect the page without needing your support. Also if you are going to use that page for your users, don't... just get a Responsive Theme.

njtweb

I'eve read through and have a couple questions.

First, I see this is helpful for Google speed which is very helpful for adsense. That would be the only reason I'd want to leverage this mod. However I also read it strips image tags in mobile devices. Is this accurate? I need my users mobile experience to be the same as on a computer.

Thank you I look forward to your response.

Antes

Quote from: njtweb on September 02, 2020, 07:14:02 AM
I'eve read through and have a couple questions.

First, I see this is helpful for Google speed which is very helpful for adsense. That would be the only reason I'd want to leverage this mod. However I also read it strips image tags in mobile devices. Is this accurate? I need my users mobile experience to be the same as on a computer.

Thank you I look forward to your response.

That's not even remotely possible with AMP. AMP is just yet another pumped project from Google, the only reason this mod exist because people should leverage off of these cherries on the top. To have proper mobile experience you should get a properly designed Responsive Theme (or RCurve if you are on default theme).

To address the BBCode issue, Unfortunately I don't have much time to spend on SMF for now. I'd love to fix at least image issue in the mod and possibly disable rest of the BBCodes in that specific mod.

njtweb

Thank you, I do use default theme and responsive curve 1.1.0. I didn't update to 1.0.1 because you didn't think it was necessary, (I commented in your dcurve thread).

Antes

SMF 2.1 ONLY - v0.0.3 released, added a nice neat hook to disable some BBCodes. Backporting this may not happen due to lack of hooks... I'll try to work-around the hooks to ensure same code backported but no promises.

spiros

Amazing work, Antes, I see you did it for SMF 2 and I installed it. A strange thing, pages validate via https://validator.ampproject.org but when I access them with my Android phone (Chrome browser), I get "sorry this page is not valid amp html" and get redirected to the forum home page. When I try with any other browser, I see the amp page.

Example pages:
https://www.translatum.gr/forum/index.php?action=amp;topic=987010
https://www.translatum.gr/forum/index.php?action=amp;topic=985701.0

spiros

#31
I got this reply:

QuoteLooking at the URL in the search result, it has a URL with parts of the query string escaped.

Original URL:
https://www.translatum.gr/forum/index.php?action=amp;topic=987010

URL in Search:
https://www.translatum.gr/forum/index.php?action=amp%3Btopic%3D985701

Using that escaped URL with both validator.amp.dev and the Chrome Extension it shows that the returned HTML is not valid AMP and is not declared as AMP.

There are two potential solutions for you, though this is outside of the scope of AMP itself.

Use & instead of ; for different query params.
Update the server for this domain to handle escaped query params for %3B (which is ;).
https://github.com/ampproject/amphtml/issues/31063

Not clear on either of these suggestions really...

This is what I can see in the way the page is linked in google search results:

<a class="C8nzq BmP5tf amp_r" data-amp="https://www.translatum.gr/forum/index.php?action=amp;topic%3D985701" data-amp-cur="https://www.translatum.gr/forum/index.php?action=amp;topic=985701" data-amp-title="translatum.gr" data-amp-vgi="8458557019360116853" href="https://www.translatum.gr/forum/index.php?action=amp;topic=985701" data-ved="2ahUKEwim8cXvrvvsAhXCMewKHYUJDfEQFjAAegQIARAB" ping="/url?sa=i&amp;source=web&amp;rct=j&amp;url=https://www.translatum.gr/forum/index.php%3Faction%3Damp%3Btopic%3D985701&amp;ved=2ahUKEwim8cXvrvvsAhXCMewKHYUJDfEQFjAAegQIARAB&amp;psig=AOvVaw3Zumwox_YowxhDDwIehV-e&amp;ust=1605214160452451&amp;ampcf=1"><div class="abuKkc IhfN8d MUxGbd lyLwlc aLF0Z"><img class="eqA2re" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAAAMklEQVR4AWMY5OD/TIb/aZgIl+o0XAinanSdBAGFGmbS0gZMLxGrgSirCAQrYT2DHwAAv0tHhsJpXPsAAAAASUVORK5CYII=" alt="Image" aria-hidden="true" data-atf="1" width="16" height="16"><span class="Zu0yb UGIkD qzEoUe">www.translatum.gr<span class="kbNtnf Jzkcjd"> › forum</span></span><span jsname="zYLzN" class="ZseVEf QzoJOb" aria-label="AMP logo"></span></div><h2 class="Uo8X3b">Web results</h2><div class="PpBGzd YcUVQe MUxGbd v0nnCb" aria-level="3" role="heading"><div class="V7Sr0 p5AXld PpBGzd YcUVQe">pre-owned -&gt; μεταχειρισμένος, δεύτερο χέρι, που είχε προηγούμενο ιδιοκτήτη, προϊδιόκτητος - Translatum</div></div></a>

Antes

I can't be sure what is causing this... Google redirects with "%3Btopic%3D985701" and either mod or server fails to redirect...

spiros

Well, apparently this does not occur on canonical URLs which have similar parameter separators. It could be a clue. For what it's worth, I tested it on 2 different sites (same server).

This is what I see when searching from Chrome desktop, which, for some strange reason, only lists the AMP page, and happily directs to it when clicked.

<a href="https://www.translatum.gr/forum/index.php?action=amp;topic=985701" ping="/url?sa=t&amp;source=web&amp;rct=j&amp;url=https://www.translatum.gr/forum/index.php%3Faction%3Damp%3Btopic%3D985701&amp;ved=2ahUKEwji8ujg-vzsAhVBsKQKHY6VDrsQFjAAegQIAxAC"><br><h3 class="LC20lb DKV0Md"><span>pre-owned -&gt; %u03BC%u03B5%u03C4%u03B1%u03C7%u03B5%u03B9%u03C1%u03B9%u03C3%u03BC%u03AD%u03BD%u03BF%u03C2, %u03B4%u03B5%u03CD%u03C4%u03B5%u03C1%u03BF %u03C7%u03AD%u03C1%u03B9, %u03C0%u03BF%u03C5 ... - Translatum</span></h3><div class="TbwUpd NJjxre"><cite class="iUh30 Zu0yb qLRx3b tjvcx">www.translatum.gr<span class="dyjrff qzEoUe"><span> %u203A forum</span></span></cite></div></a>

When I spoof the user agent to mobile from Chrome desktop, I get this (which presents the issue, apparently, it is just the = sign which is mangled there? "topic%3D985701"):

<a class="C8nzq BmP5tf amp_r" data-amp="https://www.translatum.gr/forum/index.php?action=amp;topic%3D985701" data-amp-cur="https://www.translatum.gr/forum/index.php?action=amp;topic=985701" data-amp-title="translatum.gr" data-amp-vgi="8458557019360116853" href="/url?sa=t&amp;source=web&amp;rct=j&amp;url=https://www.translatum.gr/forum/index.php%3Faction%3Damp%3Btopic%3D985701&amp;ved=2ahUKEwibmLWs-_zsAhUDKuwKHUYaB2EQFjAAegQIBBAC&amp;usg=AOvVaw1svqtelcNJFRHy1kuYwYAy&amp;ampcf=1" data-ved="2ahUKEwibmLWs-_zsAhUDKuwKHUYaB2EQFjAAegQIBBAC" oncontextmenu="google.ctpacw.cm(this)"><div class="abuKkc IhfN8d MUxGbd lyLwlc aLF0Z"><img class="eqA2re" height="16" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAAAMklEQVR4AWMY5OD/TIb/aZgIl+o0XAinanSdBAGFGmbS0gZMLxGrgSirCAQrYT2DHwAAv0tHhsJpXPsAAAAASUVORK5CYII=" width="16" alt="Image" aria-hidden="true" data-atf="1"><span class="Zu0yb UGIkD qzEoUe">www.translatum.gr<span class="kbNtnf Jzkcjd"> %u203A forum</span></span><span jsname="zYLzN" class="ZseVEf QzoJOb" aria-label="AMP logo"></span></div><h2 class="Uo8X3b">Web results</h2><div class="PpBGzd YcUVQe MUxGbd v0nnCb" aria-level="3" role="heading"><div class="V7Sr0 p5AXld PpBGzd YcUVQe">pre-owned -&gt; %u03BC%u03B5%u03C4%u03B1%u03C7%u03B5%u03B9%u03C1%u03B9%u03C3%u03BC%u03AD%u03BD%u03BF%u03C2, %u03B4%u03B5%u03CD%u03C4%u03B5%u03C1%u03BF %u03C7%u03AD%u03C1%u03B9, %u03C0%u03BF%u03C5 %u03B5%u03AF%u03C7%u03B5 %u03C0%u03C1%u03BF%u03B7%u03B3%u03BF%u03CD%u03BC%u03B5%u03BD%u03BF %u03B9%u03B4%u03B9%u03BF%u03BA%u03C4%u03AE%u03C4%u03B7, %u03C0%u03C1%u03BF%u03CA%u03B4%u03B9%u03CC%u03BA%u03C4%u03B7%u03C4%u03BF%u03C2 - Translatum</div></div></a>

I am guessing here that it is the data-amp value which matters when it comes to linking to the result.

Would be interesting to see if anybody else is using the mod and has amp results listed in Google, to double check.

Antes

Interesting part is;

/index.php?action=amp%3Btopic%3D985701

this is how I send to header

<link rel="amphtml" href="'. $scripturl . '?action=amp;topic=' . $topic .'">


the first "=" sign does not change, but after that ";" and "=" both changes... I'll research this further, unless Arantor comes around and gives the answer :P

spiros

I can see <link rel="amphtml" href="'. $scripturl . '?action=amp;topic=' . $topic .'"> in modification.xml. But if one wanted to change URL parameters for the AMP URL formation, this could not be done here, correct?

This part /index.php?action=amp%3Btopic%3D985701 is in the ping tag. It exists in Desktop search results too which are not affected by this issue.

gorbi


SusanTN

Google Notified me of an error with amp generated by this plugin.

The attribute 'type' may not appear in tag 'li'.

Here is google's amp specification

https://amp.dev/documentation/guides-and-tutorials/websites/learn/spec/amphtml?redirected


Advertisement: