• Welcome to Simple Machines Community Forum. Please login or sign up.

AMP4SMF

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

Previous topic - Next topic

Antes

Link to Mod

Adds very basic AMP support for your SMF forum... Only supported structure is topics.

SMF2: v0.0.1 (same code as SMF 2.1 version just less hooks due to core-software limitations)
SMF2.1: v0.0.3

You can support me via Twitch Prime* or Patreon.

Changelog
v0.0.3 (SMF 2.1 version only)
- Img bbcode and Code bbcode disabled.
- Poll related code removed.
v0.0.2 (SMF 2.1 version only)
! Small code adapts & more hooks
v0.0.1
! First release

-Rock Lee-

I will test it to see how it works, even if it is basic it can fulfill its function well. I saw some advertising agencies implement it in some highly modified SMF but the performance worsened (I don't know why).


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

diegolyanky


Didn't worked on 2 of my sites. SMF 2.0.17

SMF ... SimpleMachines ... Simple, but complete if you want it ;)

Arantor

Quote from: diegolyanky on July 27, 2020, 07:55:17 PM

Didn't worked on 2 of my sites. SMF 2.0.17



How did it not work? Do you go to the doctor when you are unwell and just say "I'm ill", no, you provide details. Please do so here.
No good deed goes unpunished
All helpful urges should be circumvented

diegolyanky


haha... Sorry, you're right.

I installed without problem, all fine and no errors. When I tested the AMP under search console, said: NO AMP DETECTED.

That's all...

Maybe I am doing something wrong (IDK)

Thanks a lot for your quick reply
SMF ... SimpleMachines ... Simple, but complete if you want it ;)

Antes

Quote from: diegolyanky on July 28, 2020, 08:56:12 AM

haha... Sorry, you're right.

I installed without problem, all fine and no errors. When I tested the AMP under search console, said: NO AMP DETECTED.

That's all...

Maybe I am doing something wrong (IDK)

Thanks a lot for your quick reply

There are few things;

The mod does not make your entire site AMP Valid. Its only for topics. When I try to validate a page in AMPValidator it fails but tells me that this page redirects to AMP version (weird that validator itself is not self-redirecting).

Once I tell the page that show me the redirected (AMP) results: https://search.google.com/test/amp?skip_amp_follow=true&id=APQM6j9Ket1IaCc4aCaiEA

To validate your page if it has valid AMP version... Navigate to the topic, check source file and you should see something like...

<link rel="amphtml" href="https://www.yoursite.tld/index.php?action=amp;topic=id">

if the code is there your page (SHOULD) be fine... as again we don't know how well the system works but according to their Docs, this is the way to redirect search engine (Google) to AMP page... If the following code does not exist in your page, either you didn't install the mod's edits to your custom theme or something else -which I don't know-.

-Rock Lee-

It works as it should although I thought it causes problems with the nice url, so far it works fine. But when there are citations or the code bbcode fails in the validation, not everywhere but in some specific points related to php (I have to do more tests). Left where that error marks me:

Quote<a href="" onclick="return smfSelectText(this);" class="codeoperation">[Select]</a></div><code class="bbc_code">SET xdate = %date: ~ -10,2%% date: ~ -7,2%% date: ~ -4,4%</code><br /><div class="codeheader">Código: (Windows) <a href="" onclick="return smfSelectText(this);" class="codeoperation">[Seleccionar]</a></div><code class="bbc_code">@echo on<br />

Try one 2.0.15 and two 2.0.17... In all of them something similar happens to me when I put [code][/code] with lines in php/bach/bash (I have to try more).


Regards!

ADD: Apparently the error occurs because the "onclick" attribute cannot appear in the "a" tag (it's an AMP rule from what I read). It's time to do a little more research! :P
¡Regresando como cual Fenix! ~ Bomber Code © 2020
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

marcosbr


I only have this error on topics with image from the RSS Feed Poster. (I use this mod)
AMP validator: "The tag 'img' may only appear as a descendant of tag 'noscript'. Did you mean 'amp-img'? Debug. Learn more..."


Remaining OK!

Antes

Quote from: Rock Lee on July 28, 2020, 02:47:03 PM
It works as it should although I thought it causes problems with the nice url, so far it works fine. But when there are citations or the code bbcode fails in the validation, not everywhere but in some specific points related to php (I have to do more tests). Left where that error marks me:

Quote<a href="" onclick="return smfSelectText(this);" class="codeoperation">[Select]</a></div><code class="bbc_code">SET xdate = %date: ~ -10,2%% date: ~ -7,2%% date: ~ -4,4%</code><br /><div class="codeheader">Código: (Windows) <a href="" onclick="return smfSelectText(this);" class="codeoperation">[Seleccionar]</a></div><code class="bbc_code">@echo on<br />

Try one 2.0.15 and two 2.0.17... In all of them something similar happens to me when I put [code][/code] with lines in php/bach/bash (I have to try more).


Regards!

ADD: Apparently the error occurs because the "onclick" attribute cannot appear in the "a" tag (it's an AMP rule from what I read). It's time to do a little more research! :P

Quote from: marcosbr on July 28, 2020, 10:25:35 PM

I only have this error on topics with image from the RSS Feed Poster. (I use this mod)
AMP validator: "The tag 'img' may only appear as a descendant of tag 'noscript'. Did you mean 'amp-img'? Debug. Learn more..."


Remaining OK!

That's expected... BBCodes are using different type of goodies to become alive and AMP by design is very limited system... The solution is not editing your post, please do not do that.

-Rock Lee-

I did not even think about editing topics for this error, I will look for another solution if it exists, although the impression that smf already brings cannot be used? Isn't it similar in the sense it has to be as simple as possible?

https://www.simplemachines.org/community/index.php?action=printpage;topic=574227.0 < It is even more direct than AMP or so it seems to me.


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

Arantor

Yes but it doesn't use the magical markup that Google tells you to use, so it can better make money out of your content.
No good deed goes unpunished
All helpful urges should be circumvented

Antes

Quote from: Rock Lee on July 29, 2020, 02:06:21 PM
I did not even think about editing topics for this error, I will look for another solution if it exists, although the impression that smf already brings cannot be used? Isn't it similar in the sense it has to be as simple as possible?

https://www.simplemachines.org/community/index.php?action=printpage;topic=574227.0 < It is even more direct than AMP or so it seems to me.


Regards!

The system is built based on printpage to keep the simplicity, the reality is AMP is a horrid spawn of Google... The only reason I wrote this mod because a) it was relatively easy to do b) I had time. Solution to BBCode may not be simple, I need to make some research because I honestly think, someone shouldn't just hook-into parseBBC and replace BBCodes with other ones...

Another reality is... ResponsiveCurve is 100000000000000 (0 to infinity) better than AMP can ever be, because Responsive design does not limit your functionality UNLIKE this horrid spawn of Google... The mod will become obsolete, once Google says, "okay I' f'd up... this system is not working" -which is relatively soon- because we know that they are removing limitation of promoting sites (to upper story parts) to AMP.

Quote from: Arantor on July 29, 2020, 02:19:14 PM
Yes but it doesn't use the magical markup that Google tells you to use, so it can better make money out of your content.

also +1

-Rock Lee-

Quote from: Arantor on July 29, 2020, 02:19:14 PM
Yes but it doesn't use the magical markup that Google tells you to use, so it can better make money out of your content.

If it is something I notice and more in these times, I never thought to make a site profitable because I think it loses the sense of fun when editing something and becomes an obligation. Added you need 100000000 visits to win 1USD... There are better and easier ways to get money (that's what I think).

Quote from: Antes on July 29, 2020, 02:26:02 PM
The system is built based on printpage to keep the simplicity, the reality is AMP is a horrid spawn of Google... The only reason I wrote this mod because a) it was relatively easy to do b) I had time. Solution to BBCode may not be simple, I need to make some research because I honestly think, someone shouldn't just hook-into parseBBC and replace BBCodes with other ones...

Another reality is... ResponsiveCurve is 100000000000000 (0 to infinity) better than AMP can ever be, because Responsive design does not limit your functionality UNLIKE this horrid spawn of Google... The mod will become obsolete, once Google says, "okay I' f'd up... this system is not working" -which is relatively soon- because we know that they are removing limitation of promoting sites (to upper story parts) to AMP.

It is the truth that for a while they will use AMP and then change everything, after all they must generate their profit. To see how it works it is not badly, it does not add or subtract having it installed (in forum normal operation).


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

Arantor

No, it's not about making *your* site profitable. It's about Google making money from you.
No good deed goes unpunished
All helpful urges should be circumvented

-Rock Lee-

Now that you mention it you are right and many want google to look at their websites, a perfect cycle.
¡Regresando como cual Fenix! ~ Bomber Code © 2020
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

AllMassive

Sorry, but:
What is AMP ?

efk

Quote from: AllMassive on August 10, 2020, 07:48:11 PM
Sorry, but:
What is AMP ?
Probably 99%+ members and guests will have exactly the same question. Even google fails to answer  :D
Edit: Got an idea what it could be since I saw many Amplifiers in google store in past, so it has to be Amplifier but still no clue for what since there is no info about mod.

-Rock Lee-

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

Arantor

A way of making your site easier for Google to scrape and display content from without having to send users to you / a way of displaying ads better without all the other stuff on your site.
No good deed goes unpunished
All helpful urges should be circumvented

pocttopus

Does AMP stands for Accelerated Mobile Pages?

Advertisement: