如何在DNN标头标签中以编程方式包含元标签?

时间:2019-02-06 10:47:05

标签: facebook-graph-api dotnetnuke dnn9

我想使用字符串编写器在DNN网站的标头标签中动态添加元标签。

我不确定是否可以使用DNNPageHeaderProvider来实现这一目标?

enter image description here

还是我应该做下面的例子? enter image description here

这是我要添加的Facebook Open-Graph元标记。

<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>

1 个答案:

答案 0 :(得分:0)

我想我找到了答案。

您可以使用Attribute.Add将属性添加到HtmlMeta()

HtmlMeta OpenGraphBrand = new HtmlMeta();
OpenGraphBrand.Attributes.Add("property", "product:brand");
OpenGraphBrand.Content = "Our Brand";
Page.Header.Controls.Add(OpenGraphBrand);

ASP.NET Change facebook og properties from content page