Monday, 3 June 2019

Put links in head section of view

When you work in ASP.Net MVC and you want to put links in head section but it appears after many links this is because head section code comes from shared layout. 

So if you want to add some links at the top in a view head section you need to make a render point in shared layout with a unique name and put your links inside of given name section.

Layout section 

@RenderSection("GCSS", required: false)
@RenderSection("og", required: false)

Razor/View Section

@section GCSS{

    <link href="~/assets/css/Gcss.css" rel="stylesheet" />
@section og{
<meta property="og:site_name" content="Probuzz Media" />
<meta property="og:type" content="Website" />
<meta property="og:url" content="" />
<meta property="og:title" content="Website Work Portfolio" />
<meta property="og:image" content="" />
<meta property="og:description" content="Create Political/Social Worker Website " />


No comments:

Post a comment