• Resolved Cowboy Coding

    (@devaceza-1)


    Hi,

    Good Day…

    I found out that your awesome plugin causing validation error on AMP pages “The attribute ‘href’ in tag ‘link rel=stylesheet for fonts’ is set to the invalid value ‘autoptimize/css/autoptimize_c0295bf7c0c50ee378d0bf045f8d6cef.css’.”.

    Can you help me on how to fix the issue please ?

    Thanks

    Regards

    https://ww.wp.xz.cn/plugins/autoptimize/

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

    (@futtta)

    _very_ weird devaceza; AO is not supposed to be active an AMP-pages. can you share your URL here or via futtta-at-gmail-dot-com?

    frank

    Thread Starter Cowboy Coding

    (@devaceza-1)

    Hi Frank

    I sent to your email the URL, can you confirm please that you received it?

    Thanks

    Regards,
    Aaron

    Plugin Author Frank Goossens

    (@futtta)

    OK, the problem is that AO currently bails when it encounters
    <html amp
    or
    <html ⚡

    while you have
    <html dir="ltr" amp>

    Which is correct for amp but AO just doesn’t recognize it as an AMP-page.

    Give me a second, I’ll be back with a workaround soon (and will fix for the next AO-version).

    Oh, question; which plugin are you using to have AMP-pages?

    frank

    Thread Starter Cowboy Coding

    (@devaceza-1)

    I am using the WPtouch Pro plugin using the AMP extension provided by that plugin.

    http://www.wptouch.com/extensions/amp//

    Regards,
    Aaron

    Plugin Author Frank Goossens

    (@futtta)

    ok, use this as a workaround;

    add_filter('autoptimize_filter_noptimize','amp_workaround');
    function amp_workaround($in) {
      if (strpos($_SERVER['REQUEST_URI'],'/amp/')!==false) {
    		return true;
    	} else {
    		return false;
    	}
    }

    you can add this using the code snippets plugin or in your child theme’s functions.php if you insist 😉

    frank

    Thread Starter Cowboy Coding

    (@devaceza-1)

    Hi Frank,

    I inserted your code on my child theme’s functions.php and it works!
    Thank you so much Frank.

    Plugin Author Frank Goossens

    (@futtta)

    Nice. I should be back with a more fundamental solution later today, would be great if you could test that.

    frank

    Plugin Author Frank Goossens

    (@futtta)

    OK, so the more fundamental fix is in the development-version of Autoptimize, you can see it in this GitHub commit.

    It would be great if you could test this on your site (after having disabled the code you just added to your functions.php) by either making the (small) change in wp-content/plugins/autoptimize/autoptimize.php or by downloading the zip-file from GitHub and overwriting your wp-content/plugins/autoptimize folder with the contents of the autoptimize-master folder of the zipfile.

    frank

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

The topic ‘AMP validation error’ is closed to new replies.