0

I'm trying to change the way a <title> displays. Currently it just displays the page name in most cases "Home". What I would like it to look like is "Site Collection Name - Page Name" It seems to work fine when I'm working with non-publishing sites and I noticed both use the same master page tag <title id="onetidTitle"><asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server"/></title>

So far the things I've tried:

  1. Adding a title in the SharePoint Page Properties (<--Doesn't Show up anywhere)
  2. Adding the title manually before the <asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server"/> (<-- Also didn't get recognized after publishing)

2 Answers 2

2

I also noticed that if you put some value before the placeholder in master page, it does not work. However, in your page template, if you put something like below, it will show title of the web and title of the page.

<asp:Content contentplaceholderid="PlaceHolderPageTitle" runat="server">
    <SharePoint:ProjectProperty runat="server" id="ProjectProperty1" Property="Title" /> - <SharePoint:fieldvalue id="PageTitle" FieldName="Title" runat="server"/>
</asp:Content>

Please note that control shown above displays current web’s title, if you have to write a custom control.

0
1

It is also possible, using an encoded literal. Like this:

<title id="onetidTitle">
    <SharePoint:EncodedLiteral runat="server" text="My Site" EncodeMethod='HtmlEncode' />
    <asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server"/>
</title>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.