I have implemented Omniauth and Koala7 gems to integrate my application with Facebook. Everything works well, except one minor problem with posting custom actions with custom objects.
The problem is that my object url should be the show page of a newly created post, such as /posts/1. To make this page recognized as a facebook object, I need to put facebook metatags on top of the show.html.erb like this:
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# sdff: http://ogp.me/ns/fb/sdff#">
<meta property="fb:app_id" content="myid" />
<meta property="og:type" content="sdff:post" />
<meta property="og:url" content="<%= "http://sdff.herokuapp.com" + post_path(@post) %>" />
<meta property="og:title" content="Sample" />
<meta property="og:image" content="https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png" />
</head>
The problem is that facebook object debugger recognizes this as a type:webpage
instead of type:post
. I think this is because there's already the default head tag in /layouts/application.html.erb, like so:
<head>
<title>sdff</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
I assume this because the object debugger specifically points out:
Meta Tags In Body: You have tags ouside of your . This is either because your was malformed and they fell lower in the parse tree, or you accidentally put your Open Graph tags in the wrong place. Either way you need to fix it before the tags are usable.
So how do I solve this problem?
I need to place the facebook metatags in my show.html.erb
, but the page itself is already a part of the body of the entire application layout.