“Master page editing has been disabled for this site” SharePoint workaround

masterpageeditingdisabledSteps:

1. Open a copy of your master page
2. Make your edits
3. Upload your revised master page

Let’s Do It:

Open a copy of your master page:

  1. In your browser, navigate to your site and go to Settings –> Site Settings
  2. Under Web Designer Galleries, select Master Pages
  3. “Download a copy” of seattle.master or oslo.master (whichever your site is using – if unsure, it’s likely seattle by default)
  4. Use Visual Basic or Notepad++ to open the downloaded file

Make your edits

  1. If you’re just referencing a CSS or Javascript code file in your site assets (recommended as opposed to pasting the raw script into the master page), you can do so before the closing </head> tag. Here’s an example of the format required to call a custom CSS file before the tag:
    customcss
    And here’s an example of the format required to call a custom js code before the tag:
    customjs
  2. Save your master page file to a location you’ll remember.

Upload your revised master page

  1. Go to Site Settings –> Master Pages –> Files –> Upload Document (see below)
  2. Make sure “Add as a new version to existing files” is checked so that you can always revert to a previous version easily if needed. Don’t change destination folder, but feel free to add a comment for a reminder such as “updated custom css file with [specific script addition]” so you can easily see in the list of versions what changed between each.
  3. Click Save and see if your changes worked successfully.
uploadmasterpage.png uploadmasterpage.png uploadmasterpage

Best practices:

  • Avoid doing this frequently. One way to do this is to have one custom.css file and one custom.js file in your Site Assets, refer to both in your master page code (see images above) and then you won’t need to edit your master page again to add new scripts and codes – you would edit your custom.css file and custom.js file from within SharePoint Designer and save to see changes instantly. This makes it much more manageable. Here’s how to create a custom.css and/or custom.js file:

    1. Create a new .js file in your Site Assets folder via SharePoint Designer. Name it custom.js
      addjs
    2. Open to edit as needed, then save your custom.js or custom.css file – if properly referenced in your master page, changes will be immediately reflected on your site. 
  • And even within your custom .css and .js files, I would recommend calling other script files from your Site Assets folder as opposed to pasting raw scripts in their entirety within the custom .css or .js file. Again, this just keeps these files that much more manageable. For example, rather than pasting 200 lines of script into your custom.js file, just save it in SiteAssets as a separate .js file and then reference it in custom.js like this: 
    1. Edit your new custom.js file and add a reference to your other scripts like this:
    <script type="text/javascript" src="[SITEURL]/SiteAssets/[FileName].js"></script>
    

         2. If it’s custom.css instead of custom.js, just change “text/javascript” to “text/css”.

Advertisements