AMPXF - AMP for Xenforo 2

AMPXF - AMP for Xenforo 2 [Paid] 1.4.9

No permission to buy (€50.00)
I acquired this mod today, downloaded, uploaded, installed, configured - even got the ads placed/configured, tested and.. it's working. Seemed easy enough. Thanks @mazzly . Looks good so far.
 
I have an articles add-on that I wrote that I would like to use with amp. How do I use my own .less files with this add-on? For example, when viewing an article I hide the page title and instead display it within a h1 within the article. Right now my amp pages on articles look pretty bad.
 
I have an articles add-on that I wrote that I would like to use with amp. How do I use my own .less files with this add-on? For example, when viewing an article I hide the page title and instead display it within a h1 within the article. Right now my amp pages on articles look pretty bad.
Have a look at amp_style_compatibility.less for examples on how it is done with current other addons.
I would suggest that you add your changes to amp_extra.less tho so you don't get merge conflicts the next time some compatibility it added there :) 👍
 
Have a look at amp_style_compatibility.less for examples on how it is done with current other addons.
I would suggest that you add your changes to amp_extra.less tho so you don't get merge conflicts the next time some compatibility it added there :) 👍
Thanks. Is is possible to turn off amp for certain pages? For example, I don't know if it makes sense to use amp for a list of articles but the articles instead.
 
Have a look at amp_style_compatibility.less for examples on how it is done with current other addons.
I would suggest that you add your changes to amp_extra.less tho so you don't get merge conflicts the next time some compatibility it added there :) 👍
I guess on that note, how do I prevent the css from being used except on certain templates? The is_addon function appears to apply the code to all pages if the add-on is enabled. I only want the changes applied to my article templates. Is there something I can add to my article add-on?
 
Thanks. Is is possible to turn off amp for certain pages? For example, I don't know if it makes sense to use amp for a list of articles but the articles instead.
I think currently only possible to disable it with the "Disable AMP for Forum/Node pages" option, but I guess that is not going to do what you want? 🤔

I guess on that note, how do I prevent the css from being used except on certain templates? The is_addon function appears to apply the code to all pages if the add-on is enabled. I only want the changes applied to my article templates. Is there something I can add to my article add-on?
Hmm that I haven't really investigated, but the AMP processor strips out unused CSS that won't be needed for the page.

Oh and btw, if your custom addon CSS contains !important statemtents, they will also be stripped out as AMP pages don't allow that.. Might be good to keep in mind if something looks funky :D
 
I think currently only possible to disable it with the "Disable AMP for Forum/Node pages" option, but I guess that is not going to do what you want? 🤔


Hmm that I haven't really investigated, but the AMP processor strips out unused CSS that won't be needed for the page.

Oh and btw, if your custom addon CSS contains !important statemtents, they will also be stripped out as AMP pages don't allow that.. Might be good to keep in mind if something looks funky :D
My add-on is not a forum/node so disabling that does not accomplish what I am trying to do.

As far as the css goes, I am trying to hide the page title on my article pages but not hide them on post. I normally accomplish this but adding the css to hide into the .less file my articles page uses.
 
My add-on is not a forum/node so disabling that does not accomplish what I am trying to do.

As far as the css goes, I am trying to hide the page title on my article pages but not hide them on post. I normally accomplish this but adding the css to hide into the .less file my articles page uses.
One way I was thinking it could be done is with the selectors for class that is added to pages, e.g. template-forum_list, but I now realized that the AMP addon doesn't add that class 🙈

I'll try to get out a patch release later today where the same template class is added to the pages :) 👍
 
@AndrewSimm you should now be able to utilize the .template-amp_something selector to hide the titles or whatever you want on certain pages :)
something like this would hide the title on a question thread on AMP:
CSS:
.template-amp_thread_view_type_question .p-title {
    display: none;
}

To find out the template you should be able to simply open the page for your addon modification and look at the html-element class :) 👍
 
@AndrewSimm you should now be able to utilize the .template-amp_something selector to hide the titles or whatever you want on certain pages :)
something like this would hide the title on a question thread on AMP:
CSS:
.template-amp_thread_view_type_question .p-title {
    display: none;
}

To find out the template you should be able to simply open the page for your addon modification and look at the html-element class :) 👍
Oh, wow this is awesome. Thank you so much.
 
@mazzly I have an ads add-on that I use to insert ads between paragraphs. This template modification modifies my articles add-on page template. The javascript works when not viewing in amp but it appears to be stripped out when viewing the page in amp. Any thought on how to do this?
 
@mazzly I have an ads add-on that I use to insert ads between paragraphs. This template modification modifies my articles add-on page template. The javascript works when not viewing in amp but it appears to be stripped out when viewing the page in amp. Any thought on how to do this?
AMP doesn't allow much custom JS so it is stripped out to prevent validation errors.. depending on the complexity of the JS script it might be possible to acheive the same with AMPs limited JS.. Is the addon some public one or a self made one?
 
AMP doesn't allow much custom JS so it is stripped out to prevent validation errors.. depending on the complexity of the JS script it might be possible to acheive the same with AMPs limited JS.. Is the addon some public one or a self made one?
That makes sense. I guess I am still learning here.

I have two addons and both are self made. I might release my articles add-on at some point but my ads add-on is really just a bunch of template modifications.

Here is the template modification I perform against my articles add-on article page. Right now

JavaScript:
<xf:if is="{{$xf.visitor.isMemberOf(12)}}">
    
    <xf:else/>
</script>
<xf:js>
var ad1 = document.createElement("div");
var ad2 = document.createElement("div");
var ad3 = document.createElement("div");
var ad4 = document.createElement("div");
ad1.innerHTML = "<center>ad code 1</center>";
ad2.innerHTML = "<center>ad code 2</center>";
ad3.innerHTML = "<center>ad code 3</center>";
ad4.innerHTML = "<center>ad code 4</center>";
    
var p = document.getElementById("article-insert");
var br = p.getElementsByTagName('br');

br[2].parentNode.insertBefore(ad1.cloneNode(true), br[2].nextSibling);

br[8].parentNode.insertBefore(ad2.cloneNode(true), br[8].nextSibling);

br[14].parentNode.insertBefore(ad3.cloneNode(true), br[14].nextSibling);

br[20].parentNode.insertBefore(ad4.cloneNode(true), br[20].nextSibling);
</xf:js>
</xf:if>
 
That makes sense. I guess I am still learning here.

I have two addons and both are self made. I might release my articles add-on at some point but my ads add-on is really just a bunch of template modifications.

Here is the template modification I perform against my articles add-on article page. Right now

JavaScript:
<xf:if is="{{$xf.visitor.isMemberOf(12)}}">
   
    <xf:else/>
</script>
<xf:js>
var ad1 = document.createElement("div");
var ad2 = document.createElement("div");
var ad3 = document.createElement("div");
var ad4 = document.createElement("div");
ad1.innerHTML = "<center>ad code 1</center>";
ad2.innerHTML = "<center>ad code 2</center>";
ad3.innerHTML = "<center>ad code 3</center>";
ad4.innerHTML = "<center>ad code 4</center>";
   
var p = document.getElementById("article-insert");
var br = p.getElementsByTagName('br');

br[2].parentNode.insertBefore(ad1.cloneNode(true), br[2].nextSibling);

br[8].parentNode.insertBefore(ad2.cloneNode(true), br[8].nextSibling);

br[14].parentNode.insertBefore(ad3.cloneNode(true), br[14].nextSibling);

br[20].parentNode.insertBefore(ad4.cloneNode(true), br[20].nextSibling);
</xf:js>
</xf:if>
Doesn't look too complicated at least, and seems to be "vanilla JS"

I think you could try to do this with amp-script:

I haven't done anything with that so your milage might vary 😁👍
 
@mazzly I installed the new version posted above this morning, and when I came home for lunch, I noticed the robot had stopped crawling my site, I tried to restart it, but it won't crawl now.
 
Same issue the boy is off after upgrading.

on another note I hate the errors the bot spits out for broken links. My forum is 20 years old of course old posts have broken links.

My site is a living history of the satellite tv industry.
 
Top Bottom