Nested master pages with "include" function

I originally put this question with the wrong forum I think, (Getting Started)… Sorry
My first time here and still learning about coding.

I have an English / French website.

I am using .master pages for my site layout, (master.master)
The master.master links to all my css files ,and javascript files.

I have nested master pages, (en_master.master and fr_master.master) that contain layout and menus particular to the English and French pages.

My question is about !–#include virtual="file’ I use in the fused masters as shown below.

<asp:Content ID="Content2" ContentPlaceHolderID="MenuContentPlaceholder" Runat="Server">
		<asp:ContentPlaceHolder id="MenuPlaceHolder" runat="server">
      <div style="position: relative; margin: 3pt auto 20pt auto; width: 100%">
	      _<!--#include virtual ="~/com/menu/menu-2016E.html"-->_
      </div>
   </asp:ContentPlaceHolder>

For the most part these files are just html code.
When I create them I start with a blank page with the “(DOCTYPE html ~ )” declaration my code and close (/html)

If you view a page and look at the source code you will see the “html” declaration maybe two or three times.

The console indicates that “doctype” has been declared more then once.

Is this bad practice and redundant?
Should I just write code without the “html” and "/html " for any included files?

Your master page should hold your template for almost all pages on your site. Your child pages should only contain the portions that can change from page to page.

So in essence, only your master file should contain the doctype, html, head and body elements. Your “included” and page specific files should not.

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.