I would like to use a string writer to add meta tags dynamically in the header tag of my DNN site.
I am not sure if I can use the DNNPageHeaderProvider to achieve this?
Or should I do something like the example below?
This is the facebook Open-Graph meta tags I would like to add.
<header>
...
<!-- Open Graph Metadata -->
<meta property="og:title" content="Facebook T-Shirt">
<meta property="og:description" content="Unisex Facebook T-shirt, Small">
<meta property="og:url" content="https://example.org/facebook">
<meta property="og:image" content="https://example.org/facebook.jpg">
<meta property="product:brand" content="Facebook">
<meta property="product:availability" content="in stock">
<meta property="product:condition" content="new">
<meta property="product:price:amount" content="9.99">
<meta property="product:price:currency" content="USD">
<meta property="product:retailer_item_id" content="facebook_tshirt_001">
<!-- End Open Graph Metadata -->
...
</header>
I think I found the answer.
You can use Attribute.Add to add a property to HtmlMeta()
HtmlMeta OpenGraphBrand = new HtmlMeta();
OpenGraphBrand.Attributes.Add("property", "product:brand");
OpenGraphBrand.Content = "Our Brand";
Page.Header.Controls.Add(OpenGraphBrand);