Creating a New Master Page in SharePoint 2013

This article explains how to create a Master Page in SharePoint 2013 from an existing HTML page with associated graphics, scripts, CSS files, etc.  This article is targeted primarily at designers who want to start customizing their SharePoint 2013 site with minimal fuss.  In SharePoint 2013, designers can now use HTML, CSS and JavaScript to create dynamic pages where in previous versions it required an ASP.NET developer.  This article shows a step by step example.

For this example, I have used our own web site as a starting point:

http://www.navantis.com/Portals_Collaboration.html

We’re going to convert this page into a master page for use in SharePoint 2013.

Planning Out Your Master Page

A Master Page in SharePoint represents the chrome elements of a page, e.g. those areas of the site that stay the same from page to page and the associated master styles, scripts, fonts, images, etc. that should be included on every page of your site.

For our page, we want these chunks of content in our master page as well as all the governing style sheets, JavaScript, images, etc.:

The content in the middle of the page is what will governed dynamically by SharePoint using a combination of Page Layouts and dynamic content.

Before moving to SharePoint, create a stripped down HTML file that has the chrome isolated with the appropriate images, CSS, JavaScript, etc. in folders.

The dynamic content is going to go where it says, “Dynamic content will go here”.  My folder structure looks like this:

Ok, now that we’re organized, we can create our Master Page in SharePoint 2013.

Creating a SharePoint 2013 Account

Currently, you can download and install the SharePoint 2013 beta software locally, or you can create a cloud based account.  I have used the cloud based account route because its easy and free for the moment.  Go to http://www.microsoft.com/office/preview/en/office-365-enterprise to signup for an account and you will have your own SharePoint 2013 environment in the cloud.

The same instructions should work on a local version of SharePoint 2013 as well.

Creating a Publishing Site Collection

When you are first granted a SharePoint 2013 account, you are allocated a public facing web site and a collaboration site.  You can use your public facing web site, but I recommend you create a separate Publishing Site Collection for development purposes as Microsoft only allows one public facing web site in the current cloud environment.  To create a new Publishing Site Collection, go to Admin –> SharePoint –> Site Collections and click on the New Private Site Collection button.

Now that you have a Publishing Site, you can start to customize it with your new Master Page.  Your default home page will look like this:

The Design Manager

If you click on “Design your site”, this will bring you to SharePoint 2013’s new Design Manager:

You can also reach this screen by clicking on the settings menu at the top right hand of the page and clicking on Design Manager

Mapping to the Master Page Directory

Click on 4. Edit Master Pages and you will see a screen like this:

We’re going to Convert an HTML file to a SharePoint master page.  Click on that link and you will see this dialogue box:

This directory is the folder containing Master Page and Page Layouts as well as their dependent assets (CSS files, scripts, images, etc.).  The easiest way to manage this folder is to map a network drive in Windows to this folder.  To do this go to Windows Explorer, right click on your computer and select Map Network Drive.  Copy and paste the URL for the location of this directory (it’s at the top of this dialogue box) and put in your login credentials.  You should then get a drive letter that maps to this folder and you can copy and paste files from your local machine into SharePoint directly.

NOTE: You will get an error when you map the network drive if you don’t have the “Keep me signed in” checkbox selected when you sign into Office 2013.  Sign out, delete your cookies, and re-authenticate with this box checked and it will work. 

With a mapped network drive, we can simply copy our template and dependent files into this folder.

NOTE: SharePoint 2013 will allow you to create folders in this directory, so this might help in keeping organized to create a separate folder as the root of your master page and its files. 

NOTE: If you cannot map the drive, you can also upload files through the UI by going to Site Settings and Clicking on  Master pages and page layouts.

When you click on this you will access the same master page library that is used by the Design Manager. 

If you click on files you can then upload documents and create folders through the browser UI.

Creating a Master Page from HTML

Now that we have uploaded our files, we’re going to create a Master Page.  SharePoint 2013 can take your HTML file and convert it into a ASP.NET Master Page automatically.  When it does this, it will link the HTML and Master Page together so that if you change your HTML file it will sync these changes into the Master Page.  This allows designers to now work in their comfort zone with HTML, CSS, JavaScript, etc.

Go to the Design Manager.  Click on 4. Edit Master Pages and then click on Convert an HTML File  to a SharePoint master page.

Select your HTML file and click insert.

If you go to the Design Manager, you will also now see your Master Page in the list of Master Pages:

NOTE: SharePoint 2013 expects your HTML to be XML Compliant. If you have older or non-compliant HTML you will get an error. Fix your file and try again.

If you click on the Master Page, it will take you to a preview page.  At the bottom of the page you will see a Yellow Box that represents the place holder where dynamic content is going to be inserted…We’re going to now move that place holder into where we want it to replace our dummy text in the middle of the page.

Download the HTML file from the SharePoint 2013 environment (you can just copy and paste it if you have a mapped network drive) and open it in your HTML editor and you will see that SharePoint 2013 has decorated your HTML with a number of tags.  These tags are used by SharePoint 2013 as markup to specify where to put to insert content when it generates the Master Page.  You can edit and add HTML around them and add new snippets to the HTML to add dynamic navigation, content containers, metadata etc.

In your newly improved HTML file, you will see tags in the header (used to insert metadata, title and other header information), at the top of the body (used to insert the ribbon), and at the bottom you will find a div called “ContentPlaceHolderMain”.

This is a content place holder and is used by the Page Layout to inject content dynamically.  You can move this place holder into the appropriate spot in your HTML to insert the content correctly.

Publishing Your Master Page

The last step is we need to publish our master page – its currently in draft.  If you don’t publish it you won’t see it in the Site Master Page Settings drop down menu.  To publish your page, go to Site Settings –> Master pages and page layouts and then find your HTML file.  Hit the publish button on the ribbon.

NOTE: If you try to publish the master page itself you will get an error because it is linked to the master HTML file.  If you publish the HTML file, the master page is automatically published as well.

Assigning Your Master Page to your Site

Now that your master page is published, you can assign it to your site.  All pages in your site will adopt this new chrome.  Publish sites have two types of pages: 1) publishing pages and 2) system pages.  Publishing pages are traditional web pages and System pages are views of lists, document libraries and other administrative pages.  You can assign your master page to either type of pages.

To assign your master page, go to Site Settings –> Master Page (under Look and Feel) and select your master page from the drop down list (if its not there then you probably didn’t publish it successfully or it has errors).  Your site will now adopt your new look and feel!

Here is my default site with the Master Page site assigned.

Creating a New Master Page in SharePoint 2013的更多相关文章

  1. Creating Custom Connector Sending Claims with SharePoint 2013

    from:http://blogs.msdn.com/b/security_trimming_in_sharepoint_2013/archive/2012/10/29/creating-custom ...

  2. Creating a Custom Page Layout in SharePoint 2013

    Creating a Custom Page Layout in SharePoint 2013 In my last article, I documented how to create a Ma ...

  3. Integrate SharePoint 2013 with Team Foundation Server 2012

    Now that SharePoint 2013 is out I want to make sure that I can integrate SharePoint 2013 with Team F ...

  4. SharePoint 2013的100个新功能之网站管理(二)

    一:SharePoint 2013的网站策略 网站策略指的是自动关闭或删除网站的条件.有四个选项:不自动关闭或删除网站.自动删除网站.自动关闭并删除网站和运行一个工作流来关闭.删除网站. 二:新的主题 ...

  5. Adding a WebPart to a SharePoint 2013 Master Page 分类: Sharepoint 2015-07-08 01:03 7人阅读 评论(0) 收藏

    On SharePoint 2013 you can not add the Web Parts to the master page the same way of 2010. Please use ...

  6. 转载 SharePoint 2013配置Master Page and Page Layout

    转载原地址: http://www.cnblogs.com/huangjianwu/p/4539706.html 涉及到的内容是关于SharePoint 2013如何部署自定义的母版页和布局页. 进入 ...

  7. SharePoint 2013 Deploy Master Page And Page Layout

    2013年9月27日的一篇随笔,其实也是自己编写的部署文档,由于客户是HK的,所以描述部分是用英文. 涉及到的内容是关于SharePoint 2013如何部署自定义的母版页和布局页. First, L ...

  8. sharepoint 2010 页面添加footer方法 custom footer for sharepoint 2010 master page

    转:http://blog.csdn.net/chenxinxian/article/details/8720893 在sharepoint 2010的页面中,我们发现,没有页尾,如果我们需要给页面添 ...

  9. SharePoint 2013 中使用 JavaScript Like 和Unlike list item/page/document

    SharePoint 2013中新增了很多社交功能,比如用户可以like/unlike 任何一个 list item/page/document,这是一个非常不错的功能. 但有时觉得like/unli ...

随机推荐

  1. 19.QT对话框(文件对话框,颜色对话框,字体框,自定义对话框)

    文件对话框 #include<QFileDialog> //文件对话框 void Dialog::on_pushButton_clicked() { //定义显示文件的类型 窗口标题 可供 ...

  2. ROS-SLAM-自主导航

    前言:无. 前提:已下载并编译了相关功能包集,如还未下载,可通过git下载:https://github.com/huchunxu/ros_exploring.git 一.启动仿真环境 cd ~/ca ...

  3. Spark RDD概念学习系列之transformation操作

    不多说,直接上干货! transformation操作 惰性求值 (1)RDD 的转化操作都是惰性求值的.这意味着在被调用行动操作之前Spark不会开始计算. (2)读取数据到RDD的操作也是惰性的. ...

  4. 达夫设备之js

    最近阅读<高性能JavaScript>时,在书中的“达夫设备“ . 对此,有些感悟,同时有些疑问,希望看到的朋友,能帮忙解释下,在此先提前感谢了. 1. 先说自己的理解吧: ”达夫设备“的 ...

  5. GCD与dispatch_group总结

    GCD 可以看作是集合类的操作: 集合是queue,元素是block: 集合只能添加对象,删除对象由系统完成. 同理,NSOperationQueue也可以看作是一个集合管理器. dispatch_g ...

  6. MyEclipse如何设置自动提示?

    MyEclipse --> Preferences --> Java --> Editor --> Content Assist --> Enable auto acti ...

  7. [NOIP2012提高组]开车旅行

    题目:洛谷P1081.Vijos P1780.codevs1199. 题目大意:有n座海拔高度不相同的城市(编号1~n),两城市的距离就是两城市海拔之差.规定每次只能从编号小的城市走到编号大的城市. ...

  8. [NOIPlus]斗地主

    毫无意义的一道题. 用pai[i]表示某种点数的牌的剩余量,used[i]表示单,对,三,四的出牌数,大力分类讨论,大力dfs即可...真奇葩... #include <iostream> ...

  9. ansible yum 模块 安装 vsftp

    [root@ftp:/root] > ansible ansible01 -u root -k -m yum -a 'name=vsftpd state=latest' SSH password ...

  10. markdown图片设置

    工具:typora 1. 设置图片大小(本节引用自 https://support.typora.io/Resize-Image/) Typora允许使用<img>标签显示图像,也可用于调 ...