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?
2 Answers
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>
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"/>
-
-
1Confirm your site has a name: Site Settings -> Title, Description and Icon.– webdes03Jun 7, 2012 at 15:23
-
1Inserting an empty ContentPlaceHolder will require every PageLayout/Page to add the ProjectProperty inside Jun 7, 2012 at 19:45
-
-
1As 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.– webdes03Jun 9, 2012 at 14:04