私のサイトの3つの異なるページに3つの異なるいいねボタンがあります。ボタンがどのページにあるかに基づいて、これらのogタグを動的に作成して割り当てる方法はありますか?
これが私が使っているコードです:
protected void Page_Load(object sender, EventArgs e)
{
// ADD META INFORMATION TO HEADER
HtmlHead head = (HtmlHead)Page.Header;
// KEYWORDS
HtmlMeta hm = new HtmlMeta();
hm.Name = "keywords";
hm.Content = this.metaKeywords;
head.Controls.Add(hm);
// DESCRIPTION
hm = new HtmlMeta();
hm.Name = "description";
hm.Content = this.metaDescription;
head.Controls.Add(hm);
// ************************************************************************
// <meta property="og:title" content="Faces of Metastatic Breast Cancer (MBC) Video Wall" />
// <meta property="og:type" content="cause" />
// <meta property="og:image" content="http://www.facesofmbc.org/images/MBC_Logo.png"/>
// <meta property="og:url" content="http://bit.ly/rkRwzx" />
// <meta property="og:site_name" content="Faces of Metastatic Breast Cancer (MBC)" />
// <meta property="og:description" content="I just viewed the new Faces of Metastatic Breast Cancer (MBC) video wall. For each view, comment or share of the video wall during October, Genentech will donate $1 to MBC initiatives. Watch TODAY!" />
// <meta property="fb:admins" content="653936690"/>
string ogTitle = "";
string ogType = "";
string ogImage = "";
string ogUrl = "";
string ogSiteName = "";
string ogDescription = "";
string ogAdmins = "";
if (Page.Request.Path.Contains("videoWall.aspx"))
{
hm = new HtmlMeta();
hm.Attributes.Add("property", "og:title");
hm.Content = "TEST OG TITLE";
head.Controls.Add(hm);
hm = new HtmlMeta();
hm.Name = "og:type";
hm.Content = "TEST OG TYPE";
head.Controls.Add(hm);
}
// ************************************************************************
}
私はそれが間違っていて、さまざまなアプローチがあるように見えることを知っていますが、私が何をしていたか、そして私が向かっていた方向を示しているだけです。コメントアウトされたタグは、私が必要とするタグのガイドとしてそこにあります。どんな助けでもいただければ幸いです!
前もって感謝します!