So you need a public URL with meta tags to represent an object in the OpenGraph, and one of the required meta tags is a URL property. When th开发者_开发知识库e action gets published, it links to this URL property.
Let's say I'm on http://mysite.com/A. It seems like I can't then do this:
<meta property="og:url" content="http://mysite.com/B"></meta>
Because Facebook will try to look at the root url for the meta tags. Is there any way to link to a different URL (mysite.com/B) from a given OpenGraph object URL (mysite.com/A)?
You should be able to link to another URL. But all an og:url
means is "go over to that URL and use the tags from there instead". You can either
1) put all your tags on A
and then redirect users to B
with JavaScript or User-Agent detection;
2) put your content on A
and do an og:url
to B
.
@Paul, I didn't fully understand or appreciate your comment until now - apologies and thanks.
What I learned from a little more tinkering is that on the initial post to FB with the object item url in the post, is that FB then crawls that page, gets the META tags and if you've got og:url defined it will crawl it again. It crawls it twice.
In my case, I am passing a querystring that does get parsed, but I was not setting it again in the og:url, so when it crawled my page the second time, it was not picking up the querystring variable I needed it to.
That was a dumb thing on my part. Thanks for the great answer.
Jim
精彩评论