Search code examples
htmlseometadatashare-open-graph

Can I omit "og:url" when using link rel="canonical"


When setting up a new webpage and to prevent duplicate content issues on search engines, I am using the canonical tag <link rel="canonical" href="https://example.com/slug" />.

I came across of the open graph protocol to improve the experience when sharing the webpage on social media.

In my case I am planning to use canonical to eliminate duplicates between http/https, non-www/www or remove url parameters such as https://example.com/slug?foo=bar.

For this case, it looks like the canonical tag and the open graph metadata og:url would do the same function. Should I include both or could I safely omit the og:url metadata?

Thank you in advance


Solution

  • You should use both! The reason is that og:url is only used by social media bots (Facebook, Twitter, LinkedIn), but search engine bots like Google bot will look for rel="canonical" when indexing your content.