Facebook OG tags Not Working
Asked Answered
P

5

14

I have a simple rails 3 app with a FB like button. Ive used FB OG tags to get the image other pertinent info posted during the like transaction.

when i test on my local server and after uploading, lies are posted with Facebook's default image and doesn't include other info from the OG tags.

I looked at few of the other questions on this, reviewed FB's developer instructions on how to use the OG tags and i'm certain I've entered them correctly. Wondering if there's another step or something else that i'm missing

I have the tags in my head section like so

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>my title</title>
<meta property="og:title" content="My Site" />
<meta property="og:site_name" content="My Site" />
<meta property="og:url" content="http://www.mysite.com/"/>
<meta property="og:image" content="http://www.mysite.com/assets/image.png"/>
<meta property="og:type" content="ecommerce"/>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= favicon_link_tag "/favicon.ico" %>
<%= csrf_meta_tags %>

body stuff

Platitude answered 17/12, 2013 at 3:46 Comment(2)
Use this to debug your url developers.facebook.com/tools/debugKeppel
@ranveer thanks Doing this helped me to see that the image was to small. post it as an answer and ill mark it correctPlatitude
K
31

Check out this link: http://developers.facebook.com/tools/debug

Input your url or og tag here to get if there is something wrong with your markup.

Keppel answered 18/12, 2013 at 17:28 Comment(2)
Is there a way to do this locally, before I deploy my site live? When I use my local URL I get Warning Facebook URLs cannot be crawled. (I didn't really expect it to work...)Nicholle
Not sure, you could try deploying on a test link. I mean Facebook crawling doesn't make sense for local URLs anyway.Keppel
E
4

The og:url is the url to the object.

For eg, if your object url is http://yoursite.com/object.php, then the same should be your og:url

Electrocorticogram answered 17/12, 2013 at 5:32 Comment(2)
This is needed for facebook, is a must to have. Thanks!Wolof
Thanks!! You shouldn't put a URL to promote here rather as @Sahil mentions a link to the actual page with the og:tags you're parsing. I.e. the URL that goes in the facebook debugger is the URL that goes in the og:url tag.Bette
J
1

You should include prefix in html tag:

<html prefix="og: http://ogp.me/ns#">
Juttajutty answered 7/5, 2019 at 18:10 Comment(0)
T
0

A possible problem would be that your image does not meet the minimum 200px by 200px size. Try to resize your photo to meet these requirements,which actually worked in my case.

Hope this helps.

Tearjerker answered 3/6, 2018 at 15:45 Comment(0)
C
0

Sometimes, if you previously shared a link from your website without OpenGraph tags, Facebook will cache that version of your site. If you add OG tags after that and post any links on Facebook, it will show the cached version.

To fix this, you need to go to this url https://developers.facebook.com/tools/debug/ and generate a preview. There will be an option to refresh the cache.

It should be fine, give it some time.

Alternatively, you can use this free online tool, https://advertxp.com/og-tags-generator, to preview your open graph settings.

Cobbett answered 19/1, 2023 at 5:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.