What is the simplest way of getting meta description / keywords onto my _Layout page? Something similar to how you get the page Title would be nice. Such as
<title>@ViewBag.Title</title>
<meta name="keywords" content='@ViewBag.Keywords'/>
<meta name="description" content='@ViewBag.Description'/>
My view would look something like:
@{
ViewBag.Title = "Contact Me";
ViewBag.Keywords = "My, keyword, list, etc";
}
Your view should not be responsible of that (do not add logic to views). Instead, it's the action method that should specify meta information.
Check my answer here: asp.net mvc - strategy for including SEO information such as meta keywords and descriptions
The answer still apply, although you should use ViewBag
instead of ViewData
.