Razor Engine - SEO Meta tags

前端 未结 3 1652
名媛妹妹
名媛妹妹 2020-12-24 14:01

I need to place unique description and keywords meta tags to each page. Tried this. But its not clicking.

@{
    ViewBag.Title = \"Title\";
    ViewBag.Descr         


        
3条回答
  •  醉梦人生
    2020-12-24 14:19

    You can do as you did, but you have to link them in your _Layout.cshtml. Add this to your _Layout.cshtml in the section:

    @if(ViewBag.Description!=null)
    {
        
    }
    @if(ViewBag.Keywords!=null)
    {
        
    }
    

提交回复
热议问题