I'm working on a site whose front end is in angularjs
and backend in ROR
, Same ROR API
is used in an android app
also . Now I have a situation here . I need to share my Web's post on the Social media like facebook
, twitter
and google plus
. And along with the link to the single post there should be a small preview
also (a preview of the post which crawls before posting e.g in facebook) .I did it using angular Plugins . But when it comes to Android side , what they share and what displays on Facebook is the Link only . Then i did some R&D and i came to know that it must be done on server side with social media meta tags
. I did a little bit but it still no works . I'm stuck on it . Below is what i've done so far .
def show
@post = Post.find_by_permalink(params[:id])
respond_to do |format|
format.html
format.js
end
end
In My views posts/show.html.erb
<!DOCTYPE html>
<html>
<head>
<title> Shared Question</title>
<meta property="og:title" content="My Page" />
<meta property="og:description" content="A description of my page." />
<meta property="og:image" content="http://www.example.com/images/my_lovely_face.jpg" />
<!-- etc. -->
</head>
<body>
Here is the body
</body>
</html>
I just need to show a small preview whenever some user share my web post's link on any media