Custom Metadata Type

Mark Cline asked on September 17, 2015 21:07

We have a client requirement to allow visitors to share news articles and events to facebook and let them pick the uploaded teaser image as the preview image.

Specifically we need to have a custom metadata type like this: <meta property="og:image" content="URL OF IMAGE" /> in the head.

I cannot determine how you would create custom meta data in Kentico. Can someone point me to an example or to the documentation?

Thanks Mark

Recent Answers

Dawid Jachnik answered on September 17, 2015 21:40 (last edited on December 10, 2019 02:30)

Hello Mark,

You can use HeadHTML web part on the news article or event page template and placing there meta tags with context macros retriving data from fields of document type. Example content of web part:

<meta property="og:title" content="{%NewsTitle%}" />
<meta property="og:type" content="article" />
<meta property="og:site_name" content="{%SiteContext.SiteDisplayName}" />
<meta property="og:image" content="{%GetAbsoluteUrl("/getattachment/"+NewsTeaser+"/.aspx")|(identity)GlobalAdministrator%}" />
2 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on September 17, 2015 22:20 (last edited on December 10, 2019 02:30)

I've accomplished this with an Head HTML webpart and setting the properties of those meta tags with data macros like so: <meta property="fb:url" content="{% CurrentDocument.AbsoluteURL |(identity)GlobalAdministrator%}" /> as you need. You can set the webpart to only display only for specific page types as well.

1 votesVote for this answer Mark as a Correct answer

Jeroen Fürst answered on September 18, 2015 11:56

Hi Mark, just to let you know there is a Social Media Metadata Tags web part in the Kentico Marketplace available. It works with v7 but should not be hard to update :)

0 votesVote for this answer Mark as a Correct answer

Joel Dahlin answered on November 19, 2015 21:36

   Please, sign in to be able to submit a new answer.