开发者

Sharing a webpage with embedded YouTube video won't share webpage text

开发者 https://www.devze.com 2023-04-01 16:20 出处:网络
I\'ve added a Facebook \"Like\" button to my website and I\'m sharing posts with embedded YouTube videos.

I've added a Facebook "Like" button to my website and I'm sharing posts with embedded YouTube videos.

The problem is that these shared pages on Facebook are just displaying the video preview image and webpage title. It doesn't display the webpage text. Note that I'm not tryi开发者_StackOverflowng to get the video itself to share, just the preview image, webpage title and description.

The weird thing is SOME of my YouTube video posts will extract the description from the webpage. All other shared posts from my website work fine.

As for some examples...

http://mantrasoftware.net/2011/09/02/staind-not-again-official-video/ - This page will only show the preview image and webpage title when shared to Facebook.

http://mantrasoftware.net/2011/08/29/trackmania-2-canyon-educational-video/ - This page shows the preview image, webpage title AND the webpage description (post text).

I can't figure out where these 2 pages differ for Facebook "Like" purposes. Any help would be appreciated.


You should try adding the og description tag.

More info can be found here: https://developers.facebook.com/docs/opengraph/

This description tag contains what shall be the post text.


You'll need to add some extra meta tags to your pages... You can read about the Open Graph Protocol for more details... Basically you need to add these tags to your page -

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:og="http://ogp.me/ns#"
      xmlns:fb="https://www.facebook.com/2008/fbml">
  <head>
    <title>The Rock (1996)</title>
    <meta property="og:title" content="The Rock"/>
    <meta property="og:type" content="movie"/>
    <meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>
    <meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>
    <meta property="og:site_name" content="IMDb"/>
    <meta property="fb:admins" content="USER_ID"/>
    <meta property="og:description"
          content="A group of U.S. Marines, under command of
                   a renegade general, take over Alcatraz and
                   threaten San Francisco Bay with biological
                   weapons."/>
    ...
  </head>
  ...
</html>
0

精彩评论

暂无评论...
验证码 换一张
取 消