Languages
[Edit]
EN

HTML - OG tags required for article sharing

3 points
Created by:
Wiktor-Sribiew
830

In this article, we would like to show you how to use OG tags in HTML <head> element to be able share article metadata.

OG tags store the information about the webpage. They are useful when it comes to share the article link. Any application that supports OG Tags is able to display webpage preview when link is sent. Check the previews below to see how it works.

Exmaple preview

Edit

At this moment, many applications supports link previews, e.g. Facebook Messager, Google Chats, Microsoft Skype, Microsoft Teams, Facebook WhatsApp, etc., so it is worth to add it to own webpages also.

In the below, you can see Google Chat with generated link preview during conversation:

Example webpage with supported OG tags that was shared during conversion in Google Chat that is able to extract metadata.
Example webpage link (with supported OG tags) that was shared during conversion in Google Chat.

Example template

Edit

In this section we present a template of HTML5 web page containing OG tags.

Note:

In some cases it is required to keep the OG tags order. See the The Open Graph protocol for details.

Practical example

Edit

In this section, we present example OG tags from this article placed inside the <head> element of the HTML web page template to present the correct structure of the article that we want to share.

Sharing debugger

Edit

Using Facebook Sharing Debugger tool we are able to see how shared link looks (e.g. link is available here).

Preview:

 

References

Edit
  1. The Open Graph protocol
  2. Webmasters - Sharing
  3. Webmasters - Testing

Alternative titles

  1. HTML - how to use OG tags to share article
  2. Open Graph protocol - OG tags required for article sharing
  3. Open Graph protocol - how to use OG tags to share article
  4. HTML - meta OG tags required for article sharing
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join