Go to main content

Open graph meta tags enhanced by Kentico macros

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. 

Open graph meta tags enhanced by Kentico macros

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 #%}" />


Milan Lund

is a freelance web developer and a proud Basenji owner. His specialties are Kentico CMS/EMS and Kentico Cloud.

Further reading

all posts
  • Kentico CMS & EMS

    Reload Javascript after postback in Kentico

    For any kind of form web parts, I like using update panel to avoid full page reload when the form is submitted. In such situation, a postback is invoked. When you execute a Javascr…

  • Kentico Cloud

    Request Kentico Cloud Delivery API in Node.js

    I've already done a few websites with Kentico Cloud in Node.js and I would like to share my experience. In this article I will show you how to request Kentico Cloud Delivery API in…

  • Kentico Cloud

    Multiple requests to Kentico Cloud Delivery API in Node.js

    In this article I will give you a code example that demonstrates how to make multiple endpoint requests and get one response object.