Default website image for social sharing

后端 未结 5 1730
小鲜肉
小鲜肉 2020-12-02 12:06

Is there any way to set a default image that appears when I share my website on Facebook? I\'ve noticed that Facebook usually fetches the first image from the site to use as

5条回答
  •  误落风尘
    2020-12-02 12:50

    Set an og:image in the of your HTML document like this:

    
    

    This is part of the Open Graph Protocol, respected by at least the following social media sites:

    • Facebook (see https://developers.facebook.com/docs/sharing/webmasters/#images)
    • Twitter (see https://dev.twitter.com/cards/getting-started#opengraph)
    • LinkedIn (see https://developer.linkedin.com/docs/share-on-linkedin)
    • Google+ (see https://developers.google.com/+/web/snippet/)
    • Pinterest (see https://developers.pinterest.com/docs/rich-pins/reference/)

    (... and probably plenty more besides.)

    In addition to setting the tag above, you may also want to:

    • Clear the social media platform's cached version of your page's image (e.g. by using the platform's developer tools), so that you can see the change reflected immediately. For example, you can do this for Facebook, at https://developers.facebook.com/tools/debug/
    • Add additional "structured properties" to specify things like the image's width or height, using the syntax described at http://ogp.me/#structured. This is described as a "best practice" by Facebook at https://developers.facebook.com/docs/sharing/best-practices#images.

提交回复
热议问题