--- url: "https://web.dev/articles/social-discovery" titulek: "Social discovery | Articles | web.dev" h1: "Social discovery Stay organized with collections Save and categorize content based on your preferences." popis: "You can influence the way your site appears when shared via social media by adding a few lines of code to each page. This can help bring more people to your site by providing previews with richer information than would otherwise be available." jazyk: "en" kanonicka: "https://web.dev/articles/social-discovery" drobecky: ["Articles", "Social discovery"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 00:04:23" znaku: 11004 slov: 1390 kodovani: "iso-8859-2" sha256: "e1cc9fbe8f761b049f7769cc8ee72a98460fa4d18c4d38473393a5f4745fb5f5" --- Social discovery Stay organized with collections Save and categorize content based on your preferences. You can influence the way your site appears when shared via social media by adding a few lines of code to each page. This can help bring more people to your site by providing previews with richer information than would otherwise be available. Eiji Kitamura You can influence the way your site appears when shared via social media by adding a few lines of code to each page. This can help bring more people to your site by providing previews with richer information than would otherwise be available. Summary Use schema.org microdata to provide page title, description, and an image for Google+. Use Open Graph Protocol (OGP) to provide page title, description, and an image for Facebook. Use Twitter Cards to provide page title, description, an image, and a Twitter id for Twitter. You can influence the way your site appears when shared via social media by adding a few lines of code to each page. This can help increase engagement by providing previews with richer information than would otherwise be available. Without it, social sites will provide only basic information, without images or other helpful information. Which one do you think is more likely to be clicked? People are drawn to images and feel more confident they'll like what they find when they have an early preview. With the appropriate markup: the correct title, a short description, and an image are included. Adding these items can help increase engagement. Without the proper mark up, only the page title is included. When someone on a social network wants to share your website with their friends, they would probably add some notes explaining how awesome it is, and share it. But describing a website tends be cumbersome and can miss the point from the page owner's point of view. Some services restrict the number of characters users can put in the note. By adding the appropriate metadata to your pages, you can simplify the sharing process for users by providing the title, a description, and an attractive image. This means they don't have to spend valuable time (or characters) describing the link. Use schema.org + microdata to provide rich snippets on Google+ Crawlers use many methods to parse a page and understand its content. By using [microdata](http://www.w3.org/TR/microdata/), and [schema.org](https://schema.org/) vocabulary, you help social sites and search engines better understand the contents of the page. Here's an example: `

Enjoy fireworks

Fireworks are beautiful. This article explains how beautiful fireworks are.

` While most metadata are embedded in the head section of a web page, microdata lives where the context exists. Add `itemscope` to define microdata scope By adding `itemscope`, you can specify the tag as a block of contents about a particular item. Add `itemtype` to define type of your website You can specify the type of item by using the `itemtype` attribute along with the `itemscope`. The value of an `itemtype` can be determined according to the type of content on your web page. You should be able to find one that is relevant in [this page](https://schema.org/docs/full.html). Add `itemprop` to describe each item using schema.org vocabulary `itemprop` defines properties for `itemtype` in the scope. For providing metadata to social sites, typical `itemprop` values are `name`, `description`, and `image`. Validate rich snippets To validate rich snippets on Google+, you can use tools such as: [Structured Data Testing Tool](https://www.google.com/webmasters/tools/richsnippets) - Search Console Use Open Graph Protocol (OGP) to provide rich snippets on Facebook The [Open Graph Protocol (OGP)](http://ogp.me/) provides Facebook with the metadata necessary to allow web pages to have the same functionality as other Facebook objects. ` ` When included in the head section of your page, this metadata provides rich snippet information when the page is shared. Use `og:` namespaced `meta` tags to describe metadata A `meta` tag consists of a `property` attribute and a `content` attribute. Properties and contents may take the following values: Property Content `og:title` The title of the web page. `og:description` The description of the web page. `og:url` The canonical url of the web page. `og:image` URL to an image attached to the shared post. `og:type` A string that indicates the type of the web page. You can find one that is suitable for your web page [here](https://developers.facebook.com/docs/reference/opengraph/). These meta tags provide semantic information to crawlers from social sites, like [Facebook](https://www.facebook.com/). Learn more To learn more about things you can attach to the post on Facebook, visit the official Open Graph Protocol site. [ogp.me](http://ogp.me/) Validate rich snippets To validate your markup on Facebook, you can use tools such as: [Debugger](https://developers.facebook.com/tools/debug/) Use Twitter Cards to provide rich snippets on Twitter [Twitter Cards](https://dev.twitter.com/cards/overview) are an extension to the Open [Graph Protocol applicable for Twitter](https://twitter.com/). They allow you to add media attachments like images and video to Tweets with a link to your web page. By adding the appropriate metadata, Tweets with links to your page will have a card added that includes the rich detail you've added. Use `twitter:` namespaced meta tags to describe metadata To get a Twitter Card working, [your domain must be approved](https://cards-dev.twitter.com/validator) and must contain a meta tag that has `twitter:card` as the `name` attribute instead of `property` attribute. Here's a quick example: ` ` By assigning the Twitter id to the value of twitter:site, Twitter embeds this information in the shared post so that people can easily engage with the page owner. Learn more To learn more about Twitter Cards, visit: [Twitter's developer site](https://dev.twitter.com/cards) Validate rich snippets To validate your markup, Twitter provides: [Card Validator](https://cards-dev.twitter.com/validator) The Best Practice Given all three options, the best thing you can do is to include them all in your web page. Here's an example: ` Social Site Example ` Notice that microdata and OGP share some markup: `itemscope` is located at `head` tag `title` and `description` are shared between microdata and OGP `itemprop="image"` is using `link` tag with `href` attribute instead of reusing `meta` tag with `property="og:image"` Lastly, make sure to validate that your web page appears as expected on each social site before publishing. Except as otherwise noted, the content of this page is licensed under the [Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/), and code samples are licensed under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). For details, see the [Google Developers Site Policies](https://developers.google.com/site-policies). Java is a registered trademark of Oracle and/or its affiliates. Last updated 2014-10-07 UTC.