Making the default site page title in MVC3
My Layout file has the following:
@{
ViewBag.Title = "Default page title";
}
<!DOCTYPE html>
<html>
<head>
<title>@ViewBag.Title</title>
</head>
.....
In my view, I have:
@{
ViewBag.Title = "Home";
Layout = "~/Views/Shared/_Layout.cshtml";
}
However, the page title is displayed as the "Default Page Title".
How can I get the title of a page to display as "Home"? I only need the "default page title" if I have not specified a value for ViewBag.Title
in the view.
+3
source to share