0

I have a blog on my app and on this blog I usually put some youtube videos and when I share the links of these pages on Facebook there's no thumbnail. Is there a way to do this?

I have tried to put meta-data with open graph protocol, with the youtube link but no luck.

Is this possible?

EDITED

In my app I was including the OG video tag like this:

%meta{ :property => "og:title" , :content => "#{post.title}" }
%meta{ :property => "og:type" , :content => "article" }
%meta{ :property => "og:url" , :content => "#{post_url(post.slug).sub('https:', 'http:')}" }
-if post.video_thumbnail && post.video_thumbnail != ""
  %meta{ :property => "og:video" , :content => "http://www.youtube.com/watch?v=#{post.video_thumbnail}"}

I found the answer on this question: How do I get a YouTube video thumbnail from the YouTube API?

Youtube API lets you get images from the video if used this URL:

http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg

So I included that link as my OG image tag like this:

%meta{ :property => "og:image" , :content => "http://img.youtube.com/vi/#{post.video_thumbnail}/0.jpg" }

And it work perfectly.

Community
  • 1
  • 1
Adrian Matteo
  • 987
  • 1
  • 10
  • 28

1 Answers1

5

Use Facebook's OG Debug tool to check the OG metadata that Facebook can see for your page. Go to https://developers.facebook.com/tools/debug

It's entirely possible to use the youtube video's thumbnail as your own content's OG image, but you'll probably need to use the YouTube API to get a URL to the thumbnail for your embedded video, and use that as the og:image meta content.

Connor Treacy
  • 1,072
  • 6
  • 12