Support » Plugins and Hacks » Autoptimize » [Resolved] Exklusion of HTML-Comment (Google Comment)

[Resolved] Exklusion of HTML-Comment (Google Comment)

  • Hi Futttta,

    is there any possibility to exclude an HTML comment for being compressed? E.g. there is an Google Comment for Google AdSense like this:

    <!-- google_ad_section_start --> and
    <!-- google_ad_section_end -->

    This is important for Google but at the moment the Comment will be deleted.

    Regards, Josef


Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Frank Goossens


    I think you could “abuse” AO’s support for dynamic snippets in HTML caching plugins, by putting your comments inside the dyn-snip comments, like this;

    <!-- google_ad_section_start -->

    hope this helps,

    Hi frank,

    thank you for the fast response but unfortunately this doesn’t work :-/ All three comments will be deleted from the HTML Code.

    Regards, Josef

    Appendix: I think there are a few Users which will have the same problem. Is there any possibility to include this “Google AdSense Exclusion” in the next AO release?

    Plugin Author Frank Goossens


    Hmm, in that case I can only advise to check the “Keep HTML comments?” option in the configuration-screen 🙂

    Thanks Frank. Now it works, but the solution is not satisfying. Is there any possibility to implement an exclusion of the Google AdSense comments in one of the next versions? I think this is a comment which should be never removed.

    Plugin Author Frank Goossens


    I’m pushing a “beta”-version of 1.6.6 out (download here), which has “noptimize”-support.

    A simple example of JS being excluded;
    <!--noptimize--><script>alert('this will not get autoptimized');</script><!--/noptimize-->

    This can be used to exclude JS, CSS and HTML (including comments). Looking forward to your feedback!


    thank you very much for this great support. I love this plugin 🙂

    But the noptimize tag doesn’t work. I installed the 1.6.6 version and set “Keep html comments” to disabled (no hook). If I include now the noptimize tag, all html comments are still visible in the plain html code.

    You can have an eye on my side, e.g. on this article iPhone – Navi Apps ohne Internet

    Plugin Author Frank Goossens


    It seems you have “Optimize HTML code” unchecked, can you try with that option enabled (otherwise HTML and comments are left untouched)?

    No, “Optimize HTLM code” is checked. Current settings:

    “Optimize HTML Code”: checked
    “Keep HTML comments”: unchecked
    “Optimize JavaScript Code”: checked
    “Optimize CSS Code”: checked

    There is some change, if I check and uncheck “Kepp HTML comments”. At the moment, the option is unchecked. I will send you a screen, where the option is checked and any other options are left untouched.

    Plugin Author Frank Goossens


    OK, for anyone following/ stumbling on this thread; the problem was with greediness of the “noptimize” regular expressions when more then one noptimize-block was present. Nothing two question-marks couldn’t handle (a pity I’m not that … fluent in regexes).

    The new trunk version fixes this.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Resolved] Exklusion of HTML-Comment (Google Comment)’ is closed to new replies.
Skip to toolbar