5

I am using the starter master pages from Codeplex, and I want to have the current SiteName on each page. What is the best way to do that dynamically?

10

Insert <SharePoint:ProjectProperty Property="Title" runat="server"/> into the masterpage where you want it.

Or if you want it like the default v4.master with a being in the PlaceHolderSiteName ContentPlaceHolder as a link, then use

<asp:ContentPlaceHolder id="PlaceHolderSiteName" runat="server">
    <SharePoint:SPLinkButton runat="server" NavigateUrl="~site/" id="onetidProjectPropertyTitle"><SharePoint:ProjectProperty Property="Title" runat="server" /></SharePoint:SPLinkButton>
</asp:ContentPlaceHolder>
3

There is a out of the box content placeholder containing the site name that can be placed inside your masterpage. I believe Randy has it included in the block of content placeholders at the bottom of the page, and you can just bring it up to where you want it.

<asp:ContentPlaceHolder id="PlaceHolderSiteName" runat="server"/>

  • I know. I tried that but it doesn't return any data... – mmcglynn Jun 7 '12 at 15:18
  • 1
    Confirm your site has a name: Site Settings -> Title, Description and Icon. – webdes03 Jun 7 '12 at 15:23
  • 1
    Inserting an empty ContentPlaceHolder will require every PageLayout/Page to add the ProjectProperty inside – Per Jakobsen Jun 7 '12 at 19:45
  • Title, Description and Icon have data. – mmcglynn Jun 8 '12 at 17:53
  • 1
    As Per stated (and I didn't really give you a full solution), <asp:ContentPlaceHolder id="PlaceHolderSiteName" runat="server"/> gives you the placeholder that you'd fill with the property. If that placeholder exists on your masterpage or page layout, then you can fill it with <SharePoint:ProjectProperty Property="Title" runat="server" /> which will return the site title from the "Title, Description, and Icon" configuration. – webdes03 Jun 9 '12 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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