Share via


Customizing My Sites in Microsoft SharePoint 2010

One of the most common question we get from customers is: “How should we customize My Sites?”. Different customers have different needs, but we saw a few common trends. So, we decided to put up a post to help you with common questions such as:
- How do I change the top navigation on My Sites to include other links?
- How do I brand My Sites?
- How to add a customization to all existing personal sites?
- How do I use personalization sites?

Let’s go through some of these steps now:

1. The global top navigation bar

The global top navigation bar appears on every My Site page (on both the personal and public site) to provide a uniform navigation experience throughout the portal.

  • Customizing the links

It is very easy to add or remove links on the global navigation and also to edit their display text and/or the address URL. As a site admin of the MySiteHost site collection, follow these steps:

1. Visit any page under the MySiteHost (like <mysitehost>/person.aspx) and click Site Actions --> Site Settings

2. Click on “Top link bar” under the “Look and Feel” section to add, remove, edit or reorder the links.

  • Add Personalization Site links to global navigation

As in 2007, you can create “personalization sites” and configure these links to show up on the My Site global navigation bar for the users in the Target Audience. Here are some steps to do this (the basic idea remains the same as described in https://technet.microsoft.com/en-us/library/cc262716.aspx ) :

1. Create a personalization site by selecting Site Actions --> New Site, and choosing the “personalization site” template under the Enterprise tab.

2. Go to Central Administration --> Manage Service Applications --> User Profile Service Application --> Manage. In the Manage Profile Service page, go to “Configure Personalization Site” under “My Site Settings”. Create a “New Link” with the URL of the above site and scoped to a previously compiled Target Audience.

All members in the Audience will see a link for the personalization site pinned to their global navigation bar, like this:

The users can also visit a personalization site and add the site to their top navigation by clicking the “Pin this site” menu item, as below:

Users can remove these user-pinned personalization site links from their My Site top navigation, by selecting the “Unpin this site” option:

  • Customizing the Look and Feel

We have a DelegateControl on our masterpages to hold the top navigation control. To customize the global nav area more deeply (for example, change the layout or add/remove some controls), you will need to create a new feature to bind your customized navigation control to this DelegateControl.

1. Under %Program Files%\Common Files\Microsoft Shared Debug\Web Server Extensions\14\TEMPLATE\FEATURES, create a new folder for your new feature, say MyNewNavFeature.

2. Under the MyNewNavFeature folder, create a feature.xml file to define a web feature that points to elements.xml, and an elements.xml file that binds the “GlobalNavigation” DelegateControl to a new ascx file (say, newtopnavigation.ascx) under controltemplates. Make sure that the Sequence attribute is set to a value < 100 so that this feature overrides the OOB navigation control.

Example feature.xml:
<Feature Id="<new guid>"
Title="My Feature"
Description="New Nav Feature"
Version="1.0.0.0"
Hidden="TRUE"
Scope="Web"
xmlns="https://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="elements.xml"/>
</ElementManifests>
</Feature>

Example elements.xml:
<Elements xmlns="https://schemas.microsoft.com/sharepoint/">
<Control Id="GlobalNavigation" Sequence="10" Controlsrc="~/_controltemplates/newtopnavigation.ascx" />
</Elements>

3. Create the newtopnavigation.ascx file under Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES. You can start with a copy of our out-of-box MySiteTopNavigation.ascx and tweak the styles and controls to suit your need.

4. Use feature stapling to staple this new feature to SPSPERS and SPSMSITEHOST site templates. You can run the following commands from powershell to install and enable your new feature:

a.       Install-SPFeature -path "MyNewNavFeature"
b.       Enable-SPFeature -identity "MyNewNavFeature" -URL https://<mysitehost> (Enables the new feature on the mysitehost)
c.       Enable the new feature on all personal sites:

$personalSites = get-spsite | where {$_.RootWeb.WebTemplate -eq "SPSPERS"}
foreach ($site in $personalSites) {Enable-SPFeature -Identity "MyNewNavFeature" -Url $site.Url}

 

2. The public page sub-navigation bar

Out of box, the sub-navigation bar appears on the 6 key profile pages and helps navigating between these pages easily.

  • Customizing the links

Again, it is very easy to add or remove links from this navigation and also to edit their display text and/or the address URL. As a site admin of the MySiteHost site collection, follow these steps:

1. Visit any page under the MySiteHost (like <mysitehost>/person.aspx) and click Site Actions --> Site Setting

2. Click on “Quick Launch” under the “Look and Feel” section to add, remove, edit or reorder the links.

  • Customizing the Look and Feel

To change the CSS styles on this menu, just override our default styles for .s4-sn defined in mysitelayout.css. If you want to change something on the control, edit each of the 6 profile pages in SPD and update the AspMenu control with ID=MySiteSubNavigationMenu.

3. Customizing the master pages and webparts

Customizing the master pages and webparts remain mostly identical to that in 2007.

  • Customizing the My Site Host

The public/profile pages (My Newsfeed, My Profile and other sub-navigation pages) belong to the My Site Host site collection.

The My Site Host uses use the mysite.master masterpage by default. To edit the out-of-box masterpage, you can open the site in SPD and edit the masterpage.

If you want to use your own masterpage, upload the new masterpage to the site’s Master Page Gallery under Site Settings. From Site Settings, enable the “SharePoint Server Publishing” feature under both “Site Collection features” and “Manage Site features”. This will add a “Master Page” link under the “Look and Feel” section and you can visit this link to apply your newly uploaded masterpage to the site.

To add or remove webparts from any of the My Site Host pages, the site admin could just manually add/remove appropriate webparts using the UI. This would be a one-time configuration step and all users will see this change since the My Site Host site collection is shared across all users. Of course, you can do this programmatically too.

  • Customizing the personal sites

The “My Content” link takes the user to their personal site, which is a different site collection than the My Site Host.

The personal site uses the v4.master masterpage by default. Each user is the owner of their own personal site, and can follow the above steps to customize the masterpage on their individual sites. If the admin wants to customize the masterpage on every personal site, feature stapling is the way to go. The same holds true for adding/removing webparts on the personal site. Each user can use the site web part adder to add new webparts to his personal page. If the site admin wants to add/remove/preconfigure webparts on each user’s personal site, they’ll need to use feature stapling.

 

We sincerely hope that you will find this helpful as you start rolling out My Sites, as a part of Microsoft SharePoint 2010 deployment at your enterprise. Please let us know if you have any questions, and we would be glad to help you out.

-- Aditi (from the Microsoft SharePoint 2010 Social Computing team)