I want to dynamically change in code behind facebook og properties like
< meta property="og:image" content="image_link" />
< meta property="og:title" content="title" />
How to do this?
btw. I'm adding regular meta tags like this:
HtmlMeta tag = new HtmlMeta();
tag.Name = "description";
tag.Content = message;
Page.Header.Controls.Add(tag);
Here is how you add the proprietary Facebook "property" attribute to a standard META tag:
HtmlMeta tag = new HtmlMeta();
tag.Attributes.Add("property", "og:title");
tag.Content = "MyTitle"; // don't HtmlEncode() string. HtmlMeta already escapes characters.
Page.Header.Controls.Add(tag);
if what you want is to add a property attribute in c# to HtmlControl this should be like so:
tag.Attributes.Add(KEY, VALUE);
where KEY = "property" and VALUE = "og:image"
hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With