cbstudiomx Posted January 12, 2019 Report Share Posted January 12, 2019 I found this issue on the canonical URL declaration. Google says that a normal page needs to have a canonical URL to itself. Also need to have an amp html page meta information. But, on the AMP page, the canonical URL doesn't have to be self page, but the normal page. Link to comment Share on other sites More sharing options...
Support Montgomerie Posted January 14, 2019 Support Report Share Posted January 14, 2019 Hello, Thank you for contacting MyThemeShop and sorry for any inconvenience that might have been caused due to that. Can you please tell us the AMP plugin you are using on your website? Also, please make sure you are using the latest version of the plugin. Looking forward to helping you. 🏁Rank #1 on Google With our WordPress SEO Plugin ⚡Score a 💯on PageSpeed and Dominate Search Rankings. ✏ Editing theme files? Please create a child theme to make your changes update-proof. Link to comment Share on other sites More sharing options...
cbstudiomx Posted January 14, 2019 Author Report Share Posted January 14, 2019 Hello, We use Better AMP v1.9.10 In the htmp code of the generated post or page, the canonical URL is declared by Rank Math! I think the rule has to be simple and you have to put it in to a next update: if page si AMP, canonical URL has to be the parent page else, use the actual page. Referenced AMP URL is self-canonical AMP The canonical page points to a stand-alone AMP. You cannot reference a stand-alone AMP as the AMP version of a page. Learn how to reference an AMP from a non-AMP page. Link to comment Share on other sites More sharing options...
Support Pratik.d Posted January 14, 2019 Support Report Share Posted January 14, 2019 Hello, 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 on your site please add below code to your active theme's funcitons.php file: add_action( 'rank_math/frontend/canonical', function( $url ) { if ( ! is_singular() || ! function_exists( 'better_amp_rel_canonical_url' ) ) { return $url; } $custom_url = RankMath\Post::get_meta( 'canonical_url', get_the_ID() ); if ( $custom_url ) { return $custom_url; } return better_amp_rel_canonical_url(); }); Hope that helps. Please let us know if there is anything else. Thank you. 🏁Rank #1 on Google With our WordPress SEO Plugin. ⚡Score a 💯on PageSpeed and Dominate Search Rankings. ✏ Editing theme files? Please create a child theme to make your changes update-proof. Link to comment Share on other sites More sharing options...
cbstudiomx Posted February 20, 2019 Author Report Share Posted February 20, 2019 That code did not work for me, but I search in better amp plugin for a "better" function to call and I change your code, and this work for me: 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(); }); Link to comment Share on other sites More sharing options...
Support Pratik.d Posted February 22, 2019 Support Report Share Posted February 22, 2019 Hello, Glad you got that working. We are going to get in touch with the Better AMP team soon to ask them to make their plugin compatible with Rank Math. Once that plugin is compatible you won't be needing this code. In the meantime, if there is anything else please let us know. Thank you. 🏁Rank #1 on Google With our WordPress SEO Plugin. ⚡Score a 💯on PageSpeed and Dominate Search Rankings. ✏ Editing theme files? Please create a child theme to make your changes update-proof. Link to comment Share on other sites More sharing options...
Recommended Posts