Open Graph missing url tag (which is compulsory)

#70059
  • Resolved Nc
    Rank Math free

    According to most SEO audit tools, there are 4 compulsory open graph tags: og:title, og:type, og:image, and og:url

    Ranks Math does not add the last one (og:url)

    When will Rank Math will add the url tag?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Thank you for contacting the support and sorry for any inconvenience that might have been caused due to that.

    Rank math does add the og:url to the meta tags. On your site, your theme seems to be affecting this functionality causing. If you test your site while in a different theme such as Twenty-Twenty the og:url is correctly added to your page source.

    Please get in touch with your them provider and have them look into this.

    Looking forward to helping you.

    Nc
    Rank Math free

    This is very strange: I use Astra which is the most popular theme nowadays.

    Do you have a compatibility issue with the most popular theme?

    Why you do not solve this issue?

    What exactly do you expect from the Astra guys apart from telling me to speak to RankMath to show the missing tag????

    Thanks in advance!

    Hi,

    Rank Math is 100% compatible with Astra theme.

    I am afraid it is an issue only you are facing as Rank Math is outputting og:url tag correctly with Astra theme enabled:
    https://i.rankmath.com/707dNY

    Assuming you are using the latest version of all the plugins and the themes (please update if not yet), it would seem like a conflict with one of the plugins or the theme you are using.

    To determine that, please follow this troubleshooting guide:
    https://rankmath.com/kb/check-plugin-conflicts/

    Please let me know if you find the culprit.

    Only the site admin would know and your users won’t be affected by this troubleshooting.

    Looking forward to helping you.

    Nc
    Rank Math free

    After a lot of testing, I discovered that the following line of code in functions.php of Astra Child is causing Rank Math not to deliver og:url

    add_filter( ‘rank_math/frontend/canonical’, function( $canonical ) { $canonical = false; return $canonical;});

    According to Rank Math documentation this code should ONLY REMOVE CANONICALS, and not make the og:url vanish.

    Please note that as this is a multilanguage site, the correct canonicals of everypage are added by php code (there is not a simple rule for the correct canonicals)

    Could you please let me know: i) if the code above (in theory, to remove only canonicals, not og:url) is correct, and ii) if there is any other alternative to merely avoid Rank Math from inserting canonicals (without messing up with og:url)?

    Thanks in advance!

    Hello,

    By default Rank Math uses canonical URL in og:url tag and since your theme is removing the Canonical URL the og:url tag is also getting removed along with it. Can you please contact your theme developer and ask them why they are removing the canonical URL?

    If they are generating Canonical URL from theme then please tell them to add following code to include the custom generated canonical URL in og:url tag:

    
    add_filter( 'rank_math/opengraph/url', function( $url ) {
    	return 'Custom generated Canonical URL';
    } );
    

    I hope that helps.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

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

The ticket ‘Open Graph missing url tag (which is compulsory)’ is closed to new replies.