My website is a jobs website If I share a job at the moment the url could be for example
http://jobs.com/jobs/show-job/143/Jobit-flyers-put-up/Other/
But facebook with try to scrape http://jobs.com/jobs/show-job/ because that is the canonical url.
This really sucks when someone posts it on facebook because all the OpenGraph tags are empty so the link gets the wrong thumbnail and blank information. Who knows how to fix this?
Fixed!
Inside the header of the dynamic page you are creating simply user the meta og tag
<meta property="og:url" content="<?php get_current_url(); ?>" >
Canonical URL is the URL that represent your OpenGraph object and this is intended to work that way!
You can see the answer I gave to similar question for more details.
Do NOT use the og:type of "website" if you are publishing an "article".
For example:
- If you said THIS http://jobs.com/show-job/
- is og:type = website
Then you have told facebook that this:
- http://jobs.com/jobs/show-job/143/Jobit-flyers-put-up/Other/
- is canonical for show-job/
Simply put: use the following:
- og:type = website => http://jobs.com/
- og:type = article => http://jobs.com/show-job/
- og:type = article => http://jobs.com/jobs/show-job/143/Jobit-flyers-put-up/Other/
More information here: https://ogp.me/#type_article
来源:https://stackoverflow.com/questions/10266604/canonical-url-being-linked-on-facebook-rather-than-real-url-dynamic-opengraph-t