• Resolved frizzel

    (@frizzel)


    When I enable HTML Minify Firefox tells me “Stray end tag ‘head'” and “‘body’ start tag seen, but element of the same type was already open”.

    I don’t see anything strange in the minified HTML, but when I disable minifying, the errors are gone. I tried disabling JavaScript and CSS handling and only keep HTML minifying: no change. I tried “Alternative HTML Minifying”, but that seems to do no minifying at all.

    In the end I enabled Javascript and CSS handlers in this plug-in and use a separate plug-in for html (‘Minify HTML’) and then: NO errors.

    So, I think something goes wrong in the minifying of HTML with this plug-in. The question is, what exactly.

    • This topic was modified 7 years, 2 months ago by frizzel.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Raul P.

    (@alignak)

    When you disable html minification, does your site validate on https://validator.w3.org/ ?

    It looks like you’re missing some html tag or not closing one.
    Our plugin uses mrclay minify https://github.com/mrclay/minify for this.
    The alternative version only removes extra linebreaks and spaces, it works if your theme is not optimized.

    The html minify plugin probably uses something else.

    You’re the first person ever to report problems with this feature, and I know it works perfectly on thousands of sites, having tested it with over 100 themes myself.

    That being said, I’m always looking at ways of improving things.

    If you can validate the site on w3.org and there are no missing or closing tags, then I’ll look into porting the library on html minify to my plugin.

    Thread Starter frizzel

    (@frizzel)

    It’s on a local install at the moment.

    However, I noticed a difference between the 2 methods.
    When your plug-in does the minifying there’s a line (without any tags): ob_start_detected
    That comes from All-In-One SEO Pack:

    if ( $this->ob_start_detected ) {
    			echo 'ob_start_detected ';
    		}

    When I just make that echo line empty, there are no errors in the minifying.
    I’m now only puzzled why your plug-in triggers this, and the other doesn’t.

    Thread Starter frizzel

    (@frizzel)

    I see that you are using ob_start in the HTML Minify function which triggers AIO SEO to echo that line.

    It’s probably more for their support forum, but FYI: it only happens when ‘Force Rewrite’ in AIO SEO is set to ‘on’ (using output buffering).
    However, I don’t understand why they need to print that line as without it, it works just as well as far as I can see.

    • This reply was modified 7 years, 2 months ago by frizzel.
    Thread Starter frizzel

    (@frizzel)

    FYI, I’ve opened a topic on AIO SEO support, too: it’s here

    Plugin Author Raul P.

    (@alignak)

    Thanks for letting me know about this.

    I use the AIO SEO in a couple of sites and never used the Force Rewrite option, so I didn’t know.

    I think that line of code is some sort of debug option for their developers, but they didn’t expect other plugins to use this function on the same hook and level.

    I also don’t understand why it needs to be there, so thank you for opening the topic on their forum.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Minify HTML error’ is closed to new replies.