Miscellaneous Debris

Avner Kashtan's Frustrations and Exultations
Customizing MOSS Page Title

Another odd client request that came in a while ago.

When we browse our Sharepoint site, IE's title reads "Home - My Site Name - Windows Internet Explorer". We can't find any way to remove the "Home" string, regardless of how we change the site's name. This is critical for our ISO review tomorrow!

Now, I'm no ISO reviewer, but it seems a bit excessive even for the strictest ISO test. But hey, I'm just your friendly neighborhood technical solutions provider.

The first step to changing it is to understand where this string is stored. Easiest way to do that is to open the default.aspx page with Sharepoint Designer. We can see it contains a content block that replaces the master page's Title content placeholder.

This is the master page bit (line 14 on my unedited default.master):

<Title ID=onetidTitle><asp:ContentPlaceHolder id=PlaceHolderPageTitle runat="server"/></Title>

And this is the replacement in default.aspx:

<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
 <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,multipages_homelink_text%>"
       EncodeMethod="HtmlEncode"/>
-
 
<SharePoint:ProjectProperty Property="Title" runat="server"/>
</asp:Content>

We can see that the title is made up of two parts, the localized "Home" string (in red) and the current site's name (in blue) taken from the site's properties. We have two options here - we can either find the resource string and change it, or remove it from the ASPX altogether (along with the connecting dash) and have a clean page title. The second option is pretty straightforward, so we'll focus on the first:

text="<%$Resources:wss,multipages_homelink_text%>" 

We can see that the actual text is retrieved from some Resource Manager. The format of the $Resources token is as follows:

$Resources:filename,localizedString

So what we need is the string "multipages_homelink_text" under the file wss.resx. Finding it, however, took me a while. I found the file under 12\CONFIG\Resources (under the base 12 folder) rather than the more obvious 12\RESOURCES. This folder contained wss.resx, and also wss.en-US.resx and wss.he-IL.resx, the two languages I had installed. Seemed fitting. Editing the multipages_homelink_text value in them, however, didn't seem to change anything. So I expanded the scope again.

Seems that resx files in the 12 directory are only template files, copied to each specific Virtual Server when its created. From there on, the virtual server has its own copy of the resx files, residing under C:\inetpub\wwwroot\wss\VirtualDirectories\<port>\App_GlobalResources. There I found another copy of the wss.resx file, and changing the value there instantly updated the site, no IISRESET necessary. Joy!

Published Wednesday, April 11, 2007 1:00 PM by Avner Kashtan

Filed under:

Comments

# re: Customizing MOSS Page Title@ Thursday, April 26, 2007 9:23 AM

My moss sites all have a title of default.aspx or similar.  The value is set in the site admin title setting, but is not coming through on the rendered page.  

Any thoughts?

Bob C

# re: Customizing MOSS Page Title@ Monday, April 30, 2007 2:33 PM

The code was not correct in my DefaultLayout.aspx.  This site was based on a beta, so perhaps this was just a vestage from that older WSS v3 build.

It was:

<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server"/>

Changed to:

<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">

<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,multipages_homelink_text%>"

      EncodeMethod="HtmlEncode"/> -

<SharePoint:ProjectProperty Property="Title" runat="server"/>

</asp:Content>

Bob C

# re: Customizing MOSS Page Title@ Monday, April 30, 2007 3:48 PM

This DIDNT fix sub-sites.  Sub sites don't seem to reference the defaultLayout.aspx page mentioned above.

Any ideas?

Bob C

# re: Customizing MOSS Page Title@ Thursday, May 03, 2007 12:16 PM

I fixed the issue by creating a basic Team subsite (which had correct page title logic), and reapplied my template.  If there had been more content, it would have been a bigger issue, but it is working now.

I am wondering how modifying pages (via SPDesigner) will affect this...

Bob C

# Links (4/12/2007) &laquo; Steve Pietrek&#8217;s SharePoint Stuff@ Thursday, May 24, 2007 1:16 PM

Pingback from  Links (4/12/2007) &laquo; Steve Pietrek&#8217;s SharePoint Stuff

Links (4/12/2007) « Steve Pietrek’s SharePoint Stuff

# re: Customizing MOSS Page Title@ Sunday, August 26, 2007 3:53 PM

Hi Avner,

Your post helped me a lot!

Guy Burstein

Guy Burstein

# re: Customizing MOSS Page Title@ Friday, November 02, 2007 6:53 PM

Hello and thanks for documenting this.

I have been trying to understand why every page in a WSS 3 document library that uses the "Basic Page" template is rendered with a fixed title string of "Basic Page", rather than using a title that reflects the page's name.

I've found posts elsewehre with this question but no answers. The problem seem related to your post, so I'd appreciate any light you could shed on this.

Milton Lopez

# re: Customizing MOSS Page Title@ Thursday, November 29, 2007 4:41 PM

Any luck with the "basic page" issue?

Barb Coplen

# re: Customizing MOSS Page Title@ Tuesday, February 19, 2008 5:44 PM

Can anyone tell me that in the uppermost blog...what values we have to change in wss.resx.

Thanks

Rocky

# re: Customizing MOSS Page Title@ Wednesday, April 02, 2008 1:54 AM

I didn't understood how to do this.

can you pls guid me step by step.

I tried it by replace those lines in master pages but it is throwing an error.

Guest

# re: Customizing MOSS Page Title@ Friday, April 11, 2008 3:21 PM

I couldn't get the resource file changes to show up on my pages, so I decided to edit the master page.

If you are editing the master page, the contentPlaceHolder, PlaceHolderPageTitle needs to be in the page somewhere otherwise you get an error on render.

However, this does not mean that you have to keep it as the title.  

1.  Copy the code between the <title> tags.  

2.  Paste the code after the <body> tag and wrap it in a <div> with style="display:none;"

3.  Put your own title where the original code was.

AutoSponge

# re: Customizing MOSS Page Title@ Tuesday, April 22, 2008 1:09 AM

This is a very usefull information. I have been thinking to have two different master pages; 1 with english menus and 2nd with arabic menus. But luckly, this give me a big relax

Karadas

# re: Customizing MOSS Page Title@ Monday, May 26, 2008 9:22 PM

When using sharepoint designer, if you set the page title attribute it doesn't work.

Easy fix would be using javascript as follows..

<script type="text/javascript" >

document.title = 'Some Page Title';

</script>

Balaji

# re: Customizing MOSS Page Title@ Thursday, May 29, 2008 3:07 PM

This works great with Team Sites, but with my Collaboration Portal site, the page title displays "Pages - " in the title, and I cannot find where to edit/remove it.

It is not in the default.aspx like described above.  Can anyone help?

Nick

# re: Customizing MOSS Page Title@ Friday, July 25, 2008 3:25 PM

Standard web part pages are hard coded to use the concatenation of "Document Library Name" - "Web Page File Name" as the Page Title.  The best way to change the title is by changing the Title of the Document Library that stores the page files using the "Document Library Settings".  That changes the first part.  Then change the Name of the Web Page.  That changes the 2nd part of the concatenation.

Jim

Leave a Comment

(required) 
(required) 
(optional)
(required)