WordPress.org

Ready to get started?Download WordPress

Forums

Autoptimize
[resolved] Exklusion of HTML-Comment (Google Comment) (11 posts)

  1. blog-it-solutions
    Member
    Posted 1 year ago #

    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/

  2. Frank Goossens
    Member
    Plugin Author

    Posted 1 year ago #

    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

  3. blog-it-solutions
    Member
    Posted 1 year ago #

    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

  4. blog-it-solutions
    Member
    Posted 1 year ago #

    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?

  5. Frank Goossens
    Member
    Plugin Author

    Posted 1 year ago #

    Hmm, in that case I can only advise to check the "Keep HTML comments?" option in the configuration-screen :-)

  6. blog-it-solutions
    Member
    Posted 1 year ago #

    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.

  7. Frank Goossens
    Member
    Plugin Author

    Posted 10 months ago #

    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!

  8. blog-it-solutions
    Member
    Posted 10 months ago #

    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

  9. Frank Goossens
    Member
    Plugin Author

    Posted 10 months ago #

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

  10. blog-it-solutions
    Member
    Posted 10 months ago #

    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.

  11. Frank Goossens
    Member
    Plugin Author

    Posted 10 months ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.