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


Further reading

all posts
  • Front-end & JavaScript

    Philips Hue experiments

    I created an app for the Anybody hotel that controls Philips Hue lights. However, before I was able to design and implement the app, I researched the possibilities of the technolog…

  • Kentico Xperience

    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…

  • Kontent.ai

    Request Kontent.ai Delivery API in Node.js

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