Craig Craig - 9 days ago 4
HTML Question

Multiple layout pages sharing same headers

I have a site that makes use of 3 different Layout pages. On each page, the top section is duplicated. That is, the meta tags, the css file references, some google analytics links. They're all copied and pasted to each layout page.

What concept can I use in my MVC layout, to allow me to have all of this in a single page, and then 'included' on all layout pages? I was hoping to have some form of '_global.cshtml' file, that I can just include on each layout page. Can this be done?


I think in each layout page you can declare a new layout, and point each one to a global layout.

So within each layout you would write

    Layout = "path/to/global/layout"