Hello,
I am currently working on an extension for NewsV2 on a Dynacmiweb 7 solution. I want to add og: meta tags on news article pages.
I have tried this code, but it does not add anything to the header:
using System; using Dynamicweb.NewsV2.Extensibility; using Dynamicweb.Frontend; namespace DWFacebookNewsExtension { public class AddOgMetaTag : Dynamicweb.NewsV2.Extensibility.NewsItemDetailsTemplateExtender { const string ogImageMetaTag = "<meta property=\"og:image\" content=\"{0}\"/>"; const string ogTitleMetaTag = "<meta property=\"og:title\" content=\"{0}\"/>"; const string ogDescriptionMetaTag = "<meta property=\"og:description\" content=\"{0}\"/>"; const string ogUrlMetaTag = "<meta property=\"og:url\" content=\"{0}\"/>"; public override void ExtendTemplate(Dynamicweb.Templatev2.Template t) { PageView.Current().Meta.Add("image", String.Format(ogImageMetaTag, Item.NewsImage)); PageView.Current().Meta.Add("title", String.Format(ogTitleMetaTag, Item.NewsHeading)); PageView.Current().Meta.Add("description", String.Format(ogDescriptionMetaTag, Item.NewsManchet)); PageView.Current().Meta.Add("url", String.Format(ogUrlMetaTag, Item.NewsLink)); } } }
What I am supposed to do, to get DW to render this code?
regards
Gunnar