Why not customize a SharePoint master page.

I came across this question a lot. Simple answer would be that there are times when you need to modify and some times you don’t have to. If you are an experienced developer and know the best practices, you can modify. If not stick with html as it is much easier to handle. Recently  on SharePoint stack exchange  I read some one asking how to modify seattle.master and whether he should modify or not. Below is the best answer.

Answer:

If you will bear with my I will first answer a question you did not ask, and then I’ll get to your actual question.

What did you modify exactly, the file on disk or on the web site (through SharePoint Designer or a mapped drive) ?

If you have modified the file on disk, you should copy your changes some place safe (for later, see next) and immediately revert to the original file. Any modification to SharePoint’s OOTB files are bound to a) cause loads of problems and b) be overwritten by future updates. By modifying the file on disk you are effectively changing the master page for each and every existing site that uses that style. Most files you see in a web site are in fact links to the file on disk until they are customized(next paragraph).

If you have modified the file in the web site (in _catalogs/masterpage), in effect you have customized the file, that is you have detached it from its source definition on disk and created a local copy that now lives in the database, only for that site.

What a customized file means is: – You will need to re-apply those changes manually to any other site where you want it as they are all independent. This includes production, future sites, etc. – All of those sites, after you have modified them directly, will have their own independent copy of the file which are not related to one another so you will not be able to make mass updates to your branding.

If you have only one site at this time, you might think you are ok. But SharePoint has a tendency to grow…

If you are doing custom branding, the bare minimum would be to make a copy of seattle.master to a custom name, and work on that. That will avoid you the interference headaches with official updates and modifications to the standard master page (which you should keep as fallback should things go wrong).

Next, you should really consider a deployment package (e.g. a file on disk). Then when you create a new site, you just set it to use that master page (manually, through feature activation, at this point it does not matter). This way, all of your sites will still use an un-customized master page, meaning they will in fact all be references to the one on disk. This makes updates much easier and is the norm in enterprise settings. The same goes for your CSS and JS files.

You could have CSS and JS files in the _layout directory but for this you really want a deployment package, never drop files there manually.

And now, to specifically answer your original question:

The difference between the .master and .html pages is not that much, but you can view .html as preceding the .master. Some master pages do not have an associated .html page, but if you upload a .html file SharePoint will automatically create a .master. The latter is the one that is used in the end, with the .html being more of a “designer file” and is easier to work with for most HTML folks (has all the markup as comments, so you have fewer chances of wrecking the final ASPX markup).

So, if you have both, work on the .html file. If you have only the .master, work on that one. What you should avoid is uploading a .html file, then working on both the .master and .html files because every time you save the .html SharePoint will overwrite your .master. Once the .master is generated the .html is mostly ignored by the system.

Ref

Post

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s