Reputation: 8020
My question is: How can I add meta tag from my view or partial view? Basically I want to, from the view, write a meta tag, and I want it to be displayed in the header. Is it possible?
Thank you H
Upvotes: 3
Views: 1292
Reputation: 3052
You can use sections to do this.
In you layout page you need to define the section:
<head>
@RenderSection("Head", required: false)
</head>
This section can then be used in any page that uses this layout page:
@section Head {
<meta ... >
}
Upvotes: 6