• Resolved Josh

    (@jmccallweb)


    Hello, when we turn on the Minify HTML option for site optimizations, our <pre> wrapped text loses some formatting. The situation we’re noticing is that double line breaks are removed entirely. So for instance:

    Oh, oh, oh, I’m on fire
    Oh, oh, oh, I’m on fire

    Woo-ooh-ooh
    Woo-ooh-ooh


    Becomes:

    Oh, oh, oh, I’m on fire
    Oh, oh, oh, I’m on fire
    Woo-ooh-ooh
    Woo-ooh-ooh


    I’m guessing the html minifier should ignore anything wrapped in a pre tag, and maybe <code> too.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Georgi Ganchev

    (@georgiganchev)

    Hello @jmccallweb ,

    I have reported the issue to our developers and they will review the HTML minify functionality.

    I can confirm that the formatting is not modified if the text is wrapped in <code> tags.

    Until the issue is addressed you can use any of the two filters we created that would exclude the specific URL from minify.

    You can exclude url or url that contain specific query param using the following filters that you can add to your functions.php file::

    add_filter( 'sgo_html_minify_exclude_params', 'html_minify_exclude_params' );
    function html_minify_exclude_params( $exclude_params ) {
        // Add the query params that you want to exclude.
        $exclude_params[] = 'test';
    
        return $exclude_params;
    }
    
    add_filter( 'sgo_html_minify_exclude_urls', 'html_minify_exclude' );
    function html_minify_exclude( $exclude_urls ) {
        // Add the url that you want to exclude.
        $exclude_urls[] = 'http://mydomain.com/page-slug';
    
        return $exclude_urls;
    }

    Best regards,
    Georgi Ganchev

    Thread Starter Josh

    (@jmccallweb)

    Thanks. We use the <pre> (“Verse block”) on tons of pages, so those url-based filters don’t work for us. I’ll just turn off HTML minifying for now, until a fix is released.

    Hey @jmccallweb,

    Yep, that’s what I would do.

    Please refer to this topic to learn more about SGO’s HTML, CSS, and JS Miinification features.

    We have disabled SGO’s HTML, CSS, and JS Minification for our website. It runs better.

    Hope this helps.

    Cheers 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Minify HTML overminifying text’ is closed to new replies.