asp.net mvc 5 - Add Meta tag in View page using MVC-5 -


I have two meta tags in the _Layout.cshtml master page and now I want to add a meta tag to someone in the CSSAML view page .

And I also try with this code

put _layout.cshtml in master page @RenderSection ("Metatag", incorrect);

Someone Shtml such as @ section metatags {& lt; Meta ... /> }

But the success was not found.

Also try the addition of the meta tag jquery but did not work properly.

This should work.

Here my master page is _Layout.cshtml

 >  @RenderSection ("Metatags", false) & lt; Title & gt; My asp.net application & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; @RenderBody () & lt; / Body & gt; & Lt; / Html & gt;   

here index.cshtml file

  section metatags {& lt; Meta name = "test" content = "test is" /> & Lt; Meta name = "test2" content = "test" /> } & Lt; Div & gt; Page content & lt; / Div & gt;   

Results

  & lt; Html & gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Meta name = "test" content = "test" & gt; & Lt; Meta name = "test2" content = "test" & gt; & Lt; Title & gt; My asp.net application & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div & gt; Page content & lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -