Info When Google announced AMP, I realized I'd eventually need AMP support for my vBulletin forum. After reading the AMP implementation docs, I decided to modify printthread.php file since It only displays the basic elements and contents of a thread. So, you got the idea...
Implementation
You will upload 1 file to forum root: amp.php
You will edit /includes/class_bbcode.php and edit/replace a few lines.
You will add two new templates, and edit a few.
You will probably want to customize the <style amp-custom> CSS in ampthread template.
You will find some comments in amp.php and ampthread template; modify them according to your needs (optional).
Notes I installed a fresh vBulletin 3.8 to my localhost and tested this mod. It should work just fine unless your vBulletin is highly modified. If you get validation errors, I believe you can fix them by looking at the examples (comments).
Does it work?
Open a thread from your forum.
Replace the "showthread.php" with "amp.php" in the address bar, hit enter.
Add "#development=1" at the end of the URL and refresh the page.
Open Chrome DevTools, check the console log, it should say "AMP validation successful."
Thanks for the feedback. I've been working in the Developer Console Log and have worked through all the errors, except for one...
I see where vBSEO is adding the <base href...> tag, however when I remove it, then the forum's CSS and Style doesn't load... not sure if there is a workaround...
This the last issue I need to resolve to validate AMP.
Thanks for the feedback. I've been working in the Developer Console Log and have worked through all the errors, except for one...
I see where vBSEO is adding the <base href...> tag, however when I remove it, then the forum's CSS and Style doesn't load... not sure if there is a workaround...
This the last issue I need to resolve to validate AMP.
Open vbseo\includes\functions_vbseo.php, find
Code:
$durl = 'http://'.$_SERVER['HTTP_HOST'];
right below this line there is a line starting with $newtext.
The attribute 'nowrap' may not appear in tag 'td'.
The attribute 'style' may not appear in tag 'div'.
The attribute 'style' may not appear in tag 'td'.
The tag 'img' may only appear as a descendant of tag 'noscript'. Did you mean 'amp-img'? 585 https://www.ampproject.org/docs/reference/amp-img.html
The attribute 'style' may not appear in tag 'div'.
The attribute 'nowrap' may not appear in tag 'td'.
The tag 'script' is disallowed except in specific forms.
The attribute 'nowrap' may not appear in tag 'td'.
The attribute 'style' may not appear in tag 'div'.
The attribute 'style' may not appear in tag 'td'.
The tag 'img' may only appear as a descendant of tag 'noscript'. Did you mean 'amp-img'? 585 https://www.ampproject.org/docs/reference/amp-img.html
The attribute 'style' may not appear in tag 'div'.
The attribute 'nowrap' may not appear in tag 'td'.
The tag 'script' is disallowed except in specific forms.
Any idea how to fix this?
Helped via PM.
Note: I can't answer all questions via PM but I'll try to help you fix the validation issues. I believe we covered most of them. Some plugins globally add codes/lines to many vB pages, including AMP. You should exclude them for AMP threads.