I have a webpage that I want to “LIKE” using Facebook buttons. I have Open Graph meta tags setup:
<meta property="og:title" content="...
<meta property="og:description" content="...
<meta property="og:image" content="...
I have my page setup so that the OG tags are changed depending on what GET parameters are in the URL.
Elsewhere, when I create some LIKE buttons like so:
<div class="fb-like" data-href="http://www.mysite.com/mypage/?myparam=test1" style="display:inline;" data-send="false" data-layout="button_count" data-width="55" data-show-faces="false"></div>
<div class="fb-like" data-href="http://www.mysite.com/mypage/?myparam=test2" style="display:inline;" data-send="false" data-layout="button_count" data-width="55" data-show-faces="false"></div>
You can see that the GET parameter is different in the two URLs. When I visit those URLs in the browser, the proper og meta tags are in the source.
But when I click the LIKE buttons, it appears to ignore the GET parameters and grabs just the basic/default og meta tags to post to Facebook.
Is this by design or is there something I’m doing wrong? Is there any way to use alternate og meta tags without creating different pages/URLs/routes?
Facebook now pulls the open graph data from the canonical url in the
og:urltag.If you want to change metadata using GET variables, you’ll have to have your script dynamically add them to the
og:urlcontent as well.