2011-07-28 105 views
0

我已經在我的母版頁(_Layout.cshtml)下面的代碼:MVC3母版頁RenderSection頭部

//Html tag and config 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <meta http-equiv="content-language" content="es" /> 
    <meta http-equiv="Pragma" content="no-cache" /> 

    @RenderSection("FacebookMetaTag", false) 
</head> 

然後,在我家/ Index.cshtml我:

@model Domain.Entities.Product 


@section FacebookMetaTag { 
     <meta property="og:title" content="@Model.Name"/> 
     <meta property="og:type" content="Mycompany"/> 
     <meta property="og:url" content="@Model.Url"/> 
     <meta property="og:image" content="@Model.Image"/> 
     <meta property="og:site_name" content="Mysite"/> 
     <meta property="fb:admins" content="USER_ID"/> 
     <meta property="og:description" 
       content="Model.Description"/> 
} 

....//Some other stuff.... 

當我運行我的應用程序時,FacebookMetaTag部分不在我的母版頁中。 爲什麼?我能做什麼?

在此先感謝

回答

0

我要以此來猜測你的_ViewStart.cshtml配置不正確;你可以發佈代碼嗎?

其次,HTML的其餘部分是否輸出?

馬特

-1

頭不只呈現身體呈現。所以你不能在head標籤中添加@RenderSection。