First of all thanks to Heather Soloman who posted a great article about this Create a Feature: Master Pages for Site Collections.
Here's how i set up the Custom Masterpages and depoyed them as a feature:
Create the Feature
- Create a folder called CustomMasterPages under the Features directory on the web server.
- Inside the CustomMasterPages folder create the folders:
- en-us
- Images
- Styles
- MasterPages
- PageLayouts
- JavaScript
- Copy these two files from the Features directory PublishingLayouts:
- Feature.xml, and
- ProvisionedFiles.xml
- Create a file in the MasterPages folder called CustomMaster.master
- Open CustomMaster.master in notepad and paste the following minimal master page code from Microsoft.
- Alternatively Heather Soloman has created another version of the minimal master page which is the version I used in the end. The reason for this is that Heather's version is a stripped out version of the default.master master page which includes all the functionality available. The Microsoft version has only the minimal elements included.
- Format the master page with XHTML tags & CSS.
- Change the doc type to XHTML transitional.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/transitional.dtd"> - Edit the ProvisionedFiles.xml file to provision the master page, CSS files & images etc.
<!-- _lcid="1033" _version="12.0.4407" _dal="1" -->
<!-- _LocalBinding -->
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="OSGMasterPages" Url="_catalogs/masterpage" Path="MasterPages" RootWebOnly="TRUE">
<File Url="tr_portalMaster.master" Type="GhostableInLibrary">
<Property Name="ContentType" Value="Teleport Master Page - DEFAULT PORTAL LAYOUT" />
<Property Name="PublishingPreviewImage" Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/tr_teleportLogo100.gif, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/tr_teleportLogo100.gif" />
<Property Name="MasterPageDescription" Value="This is the TelePort master page (DEFAULT CSS LAYOUT) for use with collaboration or publishing sites." />
</File>
</Module>
<Module Name="PublishingLayoutsPreviewImages" Url="_catalogs/masterpage" IncludeFolders="??-??" Path="" RootWebOnly="TRUE">
<File Url="tr_teleportLogo100.gif" Name="Preview Images/tr_teleportLogo100.gif" Type="GhostableInLibrary">
</File>
</Module>
<Module Name="Images" Url="Style Library/Images" Path="Images" RootWebOnly="TRUE">
<File Url="tr_telerealLogo102.gif" Name="tr_telerealLogo102.gif" Type="GhostableInLibrary" />
</Module>
<Module Name="OSGStyles" Url="Style Library" Path="Styles" RootWebOnly="TRUE">
<File Url="tr_core.css" Type="GhostableInLibrary" />
<File Url="tr_portalMaster.css" Type="GhostableInLibrary" />
<File Url="tr_portalMaster_IE6.css" Type="GhostableInLibrary" />
<File Url="tr_portalMaster_IE55.css" Type="GhostableInLibrary" />
</Module>
</Elements> - Add a preview image to the language folder (en-us).
- Create a unique GUID
- In the Feature.xml file:
- Change the feature ID to the unique GUID
- Change the title to Custom Master Pages
- Change the Hidden state to False
- Recycle the app pool on the WFE website
Deploying the Feature
- On the web server (DEV02) launch command prompt and change dir to:
cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN - Install the feature using STSADM:
stsadm -o installfeature -name CustomMasterPages - Go to Site Collection Features on the portal top level site and activate the feature.
To use the master page select from the drop down list on Site Settings / Site Master Page Settings
Redeploying a Feature
Changes made to the feature require that the feature is redeployed. For example; adding new master pages, css files etc. To do this:
- On the web server (DEV02) launch command prompt and change dir to:
cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN - Reinstall the feature using STSADM:
stsadm -o installfeature -name CustomMasterPages -force - Reactivate the feature in Site Collection Features by deavctivating and the activating it.
hi,
ReplyDeletei find this site, when i was looking for example of deploying custom master page from visual studio. so here is a blogpost, which describe that in detailed way, if any other visitor have the same issue:
http://sharepoint-darius.blogspot.com – Sharepoint Custom Master Page
I have been visiting various blogs for my term papers writing research. I have found your blog to be quite useful. Keep updating your blog with valuable information... Regards
ReplyDelete