Support » Plugin: Autoptimize » Exklusion of HTML-Comment (Google Comment)

  • Resolved Josef Seidl

    (@blogitsolutions)


    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

    http://wordpress.org/extend/plugins/autoptimize/

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

    (@futtta)

    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;

    <!--mclude-->
    <!-- google_ad_section_start -->
    <!--/mclude-->

    hope this helps,
    frank

    Josef Seidl

    (@blogitsolutions)

    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

    Josef Seidl

    (@blogitsolutions)

    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

    (@futtta)

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

    Josef Seidl

    (@blogitsolutions)

    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

    (@futtta)

    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!

    Josef Seidl

    (@blogitsolutions)

    Hi,

    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

    (@futtta)

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

    Josef Seidl

    (@blogitsolutions)

    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

    (@futtta)

    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 ‘Exklusion of HTML-Comment (Google Comment)’ is closed to new replies.