Social media networks need more information about your content than just an url to be able to display it in their feeds. For such a purpose we put open graph meta tags in the head section of our websites.

In Kentico we can use the Head HTML code web part to put a content into the head section of our website. In the content of this web part we can put the following code to generate open graph meta tags automatically. But read about theory first to be able to use the following code snippet properly in context of your website.
<meta property="og:title" content="{% CurrentDocument.DocumentName #%}" />
<meta property="og:type" content="article" />
<meta property="og:url" content="{% CurrentDocument.AbsoluteURL #%}" />
<meta property="og:description" content="{% StripTags(CurrentDocument.DocumentPageDescrition) #%}" />
<meta property="og:image" content="{%CurrentSite.SiteDomainName.GetAbsoluteUrl() + "/getattachment/" + CurrentDocument.MenuItemTeaserImage + CurrentDocument.NodeAliasPath #%}" />
Further reading
all postsBoost Conversions: Persist Form Data After Redirect in Xperience by Kentico
When users submit a form and are redirected to a thank-you page, a fundamental challenge emerges: the form submission data vanishes. This happens because HTTP redirects are statele…
Optimizing Image Performance in Xperience by Kentico
In this article you will learn about the XperienceCommunity.ImageProcessing package that helps you enhance your site's performance by resizing images and serving them in modern for…
Optimizing LCP Core Web Vitals metric in Xperience by Kentico widgets
In this article, I explore the challenges of optimizing the Largest Contentful Paint (LCP) Core Web Vitals metric in Xperience by Kentico widgets, particularly focusing on how to e…