Support » Plugin: LiteSpeed Cache » AMP pages optimization disabling

  • Resolved Bike Gremlin

    (@bikegremlin)


    Litespeed plugin makes website load and work much faster on the Litespeed hosti server I’m using.

    However, I’ve noticed that some optimizations create problems with AMP validation. Lazy image load for example.

    Question: can you implement an option to “tell” Litespeed plugin:
    “Don’t use this optimizations for any URL containing /?amp string”

    I know that I can exclude caching for /?amp URLs, but that doesn’t prevent the plugin from doing all the enabled optimizations of /?amp URLs, hence, I get validation problems.

    So, I can either disable some optimizations for the whole website, or have the website’s AMP pages not work correctly.

    It seems as if it’s needed to exclude some optimizations for /?amp URLs.

    I could provide a list of optimizations that create problems, so you could add that option as one setting, perhaps. So there’s not too many menu options. That is – no need to add URL exclusion entry for each and every optimization, just make one, like:

    “Enter URL for your website amp pages (“/?amp”, or “/amp”, or whatever you are using) so ‘AMP-problematic” optimizations will be excluded for those URLs, even if those optimizations are enabled for the ‘desktop website version’.”

    Not sure if I’ve explained what I mean, do ask for clarification if needed – English is not my native.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter Bike Gremlin

    (@bikegremlin)

    List of problematic optimizations which, when disabled, allow AMP page versions to pass verification and work fine:

    (5) Optimize

    Load CSS Asynchronously

    (7) Media

    Lazy Load Images
    Lazy Load Iframes

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    Please check this wiki

    https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:tuning

    there is a section “URI Excludes” , add “amp” there should disable optimization on any URI string contains “amp”

    Could you please do a screenshots of how the page is broken with css async and lazy load?

    Best regards,

    Thread Starter Bike Gremlin

    (@bikegremlin)

    Listing ?amp, or /?amp in URI Excludes didn’t help with Lazy Load Images optimization, for example.

    It seems that LiteSpeed still does optimization of pages listed in URI Excludes. Might be that the Exclusions work only for optimizations listed under (6) Tuning, not for other optimizations.

    Pages aren’t broken – they load fine. But, with “problematic” optimizations activated, pages don’t pass AMP validation – hence they won’t get stored in Google’s AMP cache and shown to visitors as such in mobile phone search results.

    My site page that shows how AMP is implemented and set up on it:
    https://bike.bikegremlin.com/7100/amp-wordpress/

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    By ” with “problematic” optimizations activated,” you mean the lazy load will break AMP validation ?

    Best regards,

    Thread Starter Bike Gremlin

    (@bikegremlin)

    Yes, exactly. It does break AMP validation. All the other “problematic” ones do.

    Test method:

    – Enable an optimization.
    – Purge all the cache.
    – Do a validation test (both using google and amp-project official validation test tools).
    – If a validation test fails – disable the optimization, purge the cache again and test validation again to confirm the optimization was the cause.

    Did that for each optimization to figure out which ones cause problems.

    • This reply was modified 5 years, 1 month ago by Bike Gremlin.
    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    I’m little confused , is lazy load the ONLY one breaks it ? or others breaks it as well ?

    and may I know which AMP plugin you are using ?

    Best regards,

    Thread Starter Bike Gremlin

    (@bikegremlin)

    First I’d like to thank you for taking the time to look into this – much appreciated.

    List of problematic optimizations (for my website at least):

    (5) Optimize
    Load CSS Asynchronously

    (7) Media
    Lazy Load Images
    Lazy Load Iframes

    I’m using AMP plugin (by WordPress.com)

    Complete list of how I’ve set up amp on my website.

    Regards,
    Relja

    I agree with bikegremlin , lazyload in litespeed does not support with AMP if enable, so have to use disable this feature maybe next update can be improve to full approve AMP

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    Yes, I did some check

    It inserts this code

    <script src="https://example.com/wp-content/plugins/litespeed-cache/js/lazyload.min.js"></script></body></html> into AMP page that breaks the validation.

    We will make improvement on this 🙂

    Best regards,

    Thread Starter Bike Gremlin

    (@bikegremlin)

    In my opinion (correct me if I’m wrong) – there really is no sense in using any of the three “problematic” optimizations for any AMP page. Why?

    Those pages are downloaded by Google, validated, then stored at Google CDN network for AMP pages.

    AMP is not directly serverd to “live” visitors on a website, so there’s no need to “lazy load images”, for example. Google has to download the entire page to their CDN, so it makes absolutely no difference whether, while doing that, Google needs to wait fot the images to load before the remiander of the page test, or it first loads text and image frames, then images themselves. It has to get the entire copy any way.

    So lazy load, async scripts and any other modifications won’t help Google download the entire page more quickly, but can cause prolbems.

    That is why I think it would be best to just disable these optimizations for AMP pages.

    Let me know if my comment needs more explaining – again, English not being my native.

    As far as errors are concerned:
    There are 4 separate validation errors caused by these three “problematic optimizations” (nothing wrong with them as they are, your plugin is brilliant, just AMP doesn’t like it for several reasons).

    One of the optimizations causes two errors, while the others cause one each.

    If you wish, I could re-enable each and let you know which error they cause. Just let me know.

    Regards

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    Please check this temporarily solution.

    Best regards,

    Thread Starter Bike Gremlin

    (@bikegremlin)

    Thank you very much. Will give it a try.

    Plugin works fast and good as it is. Adding full AMP compatibility/customization with the update would certainly be a good thing though.

    I think it’s only fair to mark this thread as “resolved” and wait for the update.

    P.S. Great work on the plugin, will make sure to write a review.

    Regards,
    Relja

    Hi @bikegremlin and thank you for pointing this out, I was having exactly the same problem (i was literally going crazy on this)… and thank you very much for the temporarily solution @qtwrk .

    Hey there,
    It seems you found a temporary solution for the lazy load image. But what about Load css asynchronously? Any solution or should I just turned it off? Thanks

    With the following code in the functions.php:
    function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() && ! defined( 'LITESPEED_NO_LAZY' ) && define( 'LITESPEED_NO_LAZY', true ) ;

    all the other conflicting optimizations can be disabled in:
    Admin > LiteSpeed Cache > Tuning > URI Excludes > ‘/?amp’

    • This reply was modified 4 years, 6 months ago by Ivan Privalov.
Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘AMP pages optimization disabling’ is closed to new replies.