Can you get correct FB Comments for each post by changing canonical url?
-
Hi,
I am changing my whole website to https instead of http.
I read in your documentation:
The og:url tag pulls from the permalink of the post/page. When the permalink changes so will that og:url. The most common request to change the og:url is when a site migrates to https and wants to keep their previous share counts.
There is example code there to do that but I am curious – can’t we go into each specific page and change the canonical url to the http: url? I read “Canonical Tags with Yoast: If you are using Yoast, simply head to the Yoast SEO options on any page or post and expand the ‘advanced’ tab. Here you will find a field where you can specify the page’s canonical URL.” So – after the SSL is turned on, the permalinks for the site will all be https I assume, so then you would go into each post and make the canonical url the http url? Would that work? I would have to do that 95 times so it would be tedious but in the code example someone said it didn’t work for them…FYI this is the official Facebook method:
Add an og:url tag to the new URL which points at the old URL (Preferred) In your new URL, you should include a link to the old URL. For example, if your new URL was https://example.com/new-url, and the old URL was https://example.com/old-url, you should include this snippet in the new-url: <meta property="og:url" content="https://example.com/old-url" /> Using this method tells the crawler that the canonical URL is at the old location, and it will use that to generate the number of likes and shares on the page. Any new likes and shares will continue to aggregate on the old URL as well. This also requires that the old URL still renders a document with Open Graph tags and returns a HTTP 200 response, at least when loaded by Facebook's crawler. If you want other clients to redirect when they visit the URL, you must send your 301 HTTP response to all non-Facebook crawler clients. The old URL should contain its own og:url tag that points to itself. You can learn how to recognize Facebook's crawler in our Sharing Best Practices Guide. This method will work with rel=canonical as well, but og:url is preferred.
The page I need help with: [log in to see the link]
- The topic ‘Can you get correct FB Comments for each post by changing canonical url?’ is closed to new replies.