Topic-icon AMP pages support and plugin error?

Active Subscriptions:

None
6 years 8 months ago #62433 by allmyhoney
Hi there, I have turned on AMP page support for Google's AMP pages in my Easyblog extension for Joomla and basically it all passes the test over at the validator except for one error message. I've checked it using the amp validator, it seems this one error take.ms/SjbPt I am required to solve. It looks like this error comes from JFB plugin. It would be great to get some advice on how to solve this error as then I would be fully approved for AMP pages.

You need to apply ?format=amp to the end of the url and it should look like this www.business-achievers.com/news/general/...r-belarus?format=amp for example.

Then I used the validator here: validator.ampproject.org/

Any help would be much appreciated.

Kind Regards,
James
The topic has been locked.
Support Specialist
6 years 8 months ago #62436 by alzander
JFBConnect already does a check of the document type to ensure that the output is set to HTML. If it's not, that script code shouldn't be included in the page. The specific line we use is:
if (!JFactory::getApplication()->isAdmin() && JFactory::getDocument()->getType() == 'html')
If the script file is still being added, it seems like EasySocial is not properly setting the document type to 'amp' or some other variant that we could detect. You may need to contact them to understand how best to handle this situation. There have been multiple attempts to add native AMP support to Joomla, but for now, each extension does their own thing.

JFBConnect specifically looks if the document type is changed to something other than HTML, which is the only signal we can use that the script tags shouldn't be added. That methodology does work for some other extensions that support AMP output.

I hope that helps explain. If you hear something back from the guys at StackIdeas, definitely let us know as we'll gladly help investigate however we can.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
6 years 8 months ago #62440 by allmyhoney
Hey Alex, thanks for looking into this for me, appreciate that as this is a little over my head to be honest. So I took your advice and went back to stackideas with this and they investigated further here.

It seems based when they checked on amp validator again, it is referring to JFBConnect as you can see here take.ms/o5xX3 they then have temporarily disabled the JFBconnect extension and it seems that they didnt hit any error as you can see here take.ms/KSPBF. So they asked me to come back here once more to yourself on this one.

I am hoping between you guys you can sort this one out because as I say its a little bit over my head here as to what the actual error might be as such but it seems the AMP pages work fine when JFBconnect is disabled but I would love to continue to use it frankly so hopefully you can help.

Thanks,
James
The topic has been locked.
Support Specialist
6 years 8 months ago #62447 by alzander
I agree that JFBConnect is inserting the tag.

The issue is that JFBConnect is properly checking to see if the page is an HTML page and Joomla is responding that it is. If the page is actually an AMP page, then EasySocial should be updating the document type to specify that so that JFBConnect knows *not* to insert the extra tags.

Please point the support from EasySocial to this page and we'll gladly help work through it however we can. The main issue right now is that there's no way for JFBConnect to know the page is using AMP output vs HTML, which means JFBConnect has no way to change it's behavior.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
6 years 8 months ago #62454 by allmyhoney
Thanks Alex, I have now informed Stackideas of this thread so hopefully they will be in touch soon to sort it out one way or another. Thanks for your time on this.
The topic has been locked.
Active Subscriptions:

None
6 years 8 months ago #62459 by allmyhoney
Hi Alex, ok I have some good news here. I assumed I was on the latest version of your plugin to be honest but maybe I am not. In order to update do I just install the new one over the last one or is there any special steps needed - i of course do not want to wipe our my setup on my site. here is what stack ideas have sad:


Thanks James! I tried looking at their plugin file /plugins/system/jfbcsystem/jfbcsystem.php and none of the code that Alex mentioned on www.sourcecoast.com/forums/jfbconnect/jf...ort-and-plugin-error is in the plugin. Are you running on their latest version?

Anyway I have added a fix in the plugin /plugins/system/jfbcsystem/jfbcsystem.php on your site at line 35,


if (JFactory::getDocument()->getType() != 'html') {
return;
}
view raw
snippet.html hosted with ❤ by GitHub


After adding the codes, it is no longer generating any errors on search.google.com/test/amp?id=ydBBgSJZqbIUJavHWW46zA

Perhaps you want to check this with Alex and see if you are on their latest version?
The topic has been locked.
Support Specialist
6 years 8 months ago #62463 by mel
You should just be able to install the new package to upgrade. You do not need to uninstall it first. Any settings that you have configured with your current version will remain. Of course, we always recommend backing up your site prior to any upgrade or installation, just in case.

-Melissa
The topic has been locked.
Active Subscriptions:

None
6 years 8 months ago #62475 by joomleb
Hi guys,
I'm interested, so I'm following the thread.

@Mel
Sorry, I don't understand your answer, What does that have to do with what @allmyhoney said on last reply ?
The topic has been locked.
Support Specialist
6 years 8 months ago #62477 by alzander
joomleb,
StackIdeas looked at the code on allmyhoney's site. The code we said should be preventing our code from running on AMP based pages wasn't actually in the version of JFBConnect that allmyhoney was using. I don't know exactly what version the line we mentioned in my 2nd post was added, but upgrading to the latest release was what allmyhoney was asking about and Melissa let him know how to do it.

The code change that Stackideas sent could cause some other issues as it basically disables JFBConnect on all non-HTML pages, so I'd recommend using the latest version of our code which has a similar line to what they added but at line 173 in the onAfterRender function.

I hope that helps explain!
Alex
The topic has been locked.
Support Specialist
6 years 8 months ago #62478 by alzander
allmyhoney - The latest version of JFBConnect is v7.2.1. Can you check if that's the version you're using and, if not, let us know which you are using.

Thanks,
Alex
The topic has been locked.