How to use the 'og' (Open Graph) meta tag for Facebook share

后端 未结 3 1239
既然无缘
既然无缘 2020-11-29 14:47

Facebook fetches all pictures from my site.

I want to share only one picture which is on that page.

I heard about the og meta tag, but I don\'t

相关标签:
3条回答
  • 2020-11-29 15:05

    I built a tool for meta generation. It pre-configures entries for Facebook, Google+ and Twitter, and you can use it free here: http://www.groovymeta.com

    To answer the question a bit more, OG tags (Open Graph) tags work similarly to meta tags, and should be placed in the HEAD section of your HTML file. See Facebook's best practises for more information on how to use OG tags effectively.

    0 讨论(0)
  • 2020-11-29 15:17

    Use:

    <!-- For Google -->
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    
    <meta name="author" content="" />
    <meta name="copyright" content="" />
    <meta name="application-name" content="" />
    
    <!-- For Facebook -->
    <meta property="og:title" content="" />
    <meta property="og:type" content="article" />
    <meta property="og:image" content="" />
    <meta property="og:url" content="" />
    <meta property="og:description" content="" />
    
    <!-- For Twitter -->
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:title" content="" />
    <meta name="twitter:description" content="" />
    <meta name="twitter:image" content="" />
    

    Fill the content =" ... " according to the content of your page.

    For more information, visit 18 Meta Tags Every Webpage Should Have in 2013.

    0 讨论(0)
  • 2020-11-29 15:19

    Facebook uses what's called the Open Graph Protocol to decide what things to display when you share a link. The OGP looks at your page and tries to decide what content to show. We can lend a hand and actually tell Facebook what to take from our page.

    The way we do that is with og:meta tags.

    The tags look something like this -

      <meta property="og:title" content="Stuffed Cookies" />
      <meta property="og:image" content="http://fbwerks.com:8000/zhen/cookie.jpg" />
      <meta property="og:description" content="The Turducken of Cookies" />
      <meta property="og:url" content="http://fbwerks.com:8000/zhen/cookie.html">
    

    You'll need to place these or similar meta tags in the <head> of your HTML file. Don't forget to substitute the values for your own!

    For more information you can read all about how Facebook uses these meta tags in their documentation. Here is one of the tutorials from there - https://developers.facebook.com/docs/opengraph/tutorial/


    Facebook gives us a great little tool to help us when dealing with these meta tags - you can use the Debugger to see how Facebook sees your URL, and it'll even tell you if there are problems with it.

    One thing to note here is that every time you make a change to the meta tags, you'll need to feed the URL through the Debugger again so that Facebook will clear all the data that is cached on their servers about your URL.

    0 讨论(0)
提交回复
热议问题