How to control what Facebook shows when a page is shared
You have probably seen that the preview of a page shared on Facebook is not ideal. Sometimes Facebook misses the best photo, other times you need a different description just for Facebook, and so on. There are many problems with the data Facebook takes from a page when it is shared, and all of them can be avoided with OGP meta tags (Open Graph).
Open Graph uses OGP meta tags to describe the page more precisely. For example, the og:site_name tag gives the name of the website and og:locale its language, and so on. All of this is extra information that Facebook can use for its own needs and also for yours – the page is described exactly the way you want.
And exactly this extra information can be used to fine-tune what our Big Brother takes after a click on the Share button.
Example:
<head> ... <meta property="og:title" content="Title of the page on Facebook" /> <meta property="og:description" content="Description of the page for sharing on Facebook" /> <meta property="og:type" content="website" /> <meta property="og:url" content="https://www.example.com/" /> <meta property="og:image" content="https://www.example.com/image-for-facebook-sharing.png" /> ... </head>
The list of all tags is on the website https://ogp.me/.
When everything is ready, all that is left is to test it and tell Facebook that the page has changed. How? Open https://developers.facebook.com/tools/debug/, enter the address of your page and you will see right away what the social network has read and what it will show. The same tags are also used by other social networks and messaging apps – see Structured data and link previews.