Add support: Better AMP – WordPress Complete AMP

#1632
  • Resolved Gemuz
    Rank Math free

    When you turn on the amp module, the canonical link is not set correctly.
    The canonical link should go to the page normal page, not amp.

    • This topic was modified 5 years, 9 months ago by Gemuz. Reason: add link
Viewing 15 replies - 1 through 15 (of 17 total)
  • Todd
    Rank Math free

    Hello Gemuz,

    Thank you for getting in touch.

    Could you please confirm which AMP plugin you are using?

    Gemuz
    Rank Math free

    Better AMP – WordPress Complete AMP

    https://betterstudio.com/wp-plugins/better-amp/

    Shipped for my themes.

    I confirm the exact same issue on all of my amp links.
    Same Amp Plugin, It is kinda integrated into my theme, so I cannot use another one.
    Search console shows the following error :
    Referenced AMP URL is self-canonical AMP

    Here is a link to a free standalone version.

    https://wordpress.org/plugins/better-amp/

    Hello,

    Thank you for contacting Rank Math today.

    I have just tested this out with the free version of Better Amp as mentioned by Obai but I could not reproduce the canonical link issue on my test pages.

    Would you mind sharing some temporary admin access to your site so that I can chase this down further? You can do this by editing the sensitive data section and adding some temporary admin level user credentials.

    Looking forward to helping you. Thank you.

    ​​​​​​

    Gemuz
    Rank Math free

    Added options to log into my wp

    Hello,

    Thank you for sharing the access.

    I am afraid that the credentials do not seem to work from my end. Kindly check them so that I can be able to login.

    Looking forward to helping you. Thank you.

    ​​​​​​

    Gemuz
    Rank Math free

    Added the correct data.

    Hello,

    Thank you for the follow up.

    I have turned on the AMP module on your site but I cannot replicate the issue mentioned. Please take a look at the attached screenshot on the sensitive data section.
    I would suggest that you test this out from a different browser and let me know how this goes.

    Looking forward to helping you. Thank you.

    ​​​​​​

    Gemuz
    Rank Math free

    I had caching enabled.
    Now the error repeats.
    Data has changed.

    Gemuz
    Rank Math free

    error only on amp pages

    Hello,

    Thank you for the follow up.

    I have now been able to reproduce this issue on the amp pages and this issue has been raised with our dev team. We will be getting back to you in a short while.

    Looking forward to helping you. Thank you.

    ​​​​​​

    Gemuz
    Rank Math free

    Access will be closed.
    If you need access, please let me know.

    Todd
    Rank Math free

    Hello,

    We will definitely keep you in the loop.

    Hello,

    I wanted to chime in to help. Currently, Rank Math is not fully compatible with Better AMP plugin. I’ve forwarded this issue to our development team and they will release an update soon addressing this issue.

    For not to fix it please add below code to your active theme’s funcitons.php file:

    
    add_action( 'rank_math/frontend/canonical', function( $url ) {
    	if ( ! is_singular() || ! is_category() || ! function_exists( 'better_amp_get_canonical_url' ) ) {
    		$url = better_amp_guess_none_amp_url();
    		return $url;
    	}
    	$custom_url = RankMath\Post::get_meta( 'canonical_url', get_the_ID() );
    	if ( $custom_url ) {
    		return $custom_url;
    	}
    	return better_amp_get_canonical_url();
    });
    

    This should fix the canonical URL issue on AMP pages.

    Hope that helps. Thank you.

    Gemuz
    Rank Math free

    This code works.

Viewing 15 replies - 1 through 15 (of 17 total)

The ticket ‘Add support: Better AMP – WordPress Complete AMP’ is closed to new replies.