I want to display title of site in Page Layout. How do I do that?
Let's say I have a site with 3 pages and on each page I want to display title of my site. Is there a code that I can use in Page Layout to do this job?



<SharePoint:FieldValue FieldName="Title" runat="server"/>

for Page title or

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

for Site title

in one of the ContentPlaceHolders in the PageLayout, for the body in the

<asp:Content runat="server" ContentPlaceholderID="PlaceHolderMain">
  • 1
    I pasted Site Title code inside PlaceHolderMain in my Page Layout but getting error "Unknown server tag 'SharePoint:ProjectProperty'". Looks like some assembly or reference is missing which I need to add in page layout!? Sep 4 '13 at 12:41
  • 2
    <%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> Sep 4 '13 at 13:09

You can do it using Design manager, using the following snippet:

<h1 id="custom-pagetitle">
<!--MS:<asp:ContentPlaceHolder ID="PlaceHolderPageTitleInTitleArea" runat="server">-->
    <!--CS: Start Page Field: Title Snippet-->
    <!--SPM:<%@Register Tagprefix="PageFieldFieldValue" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
    <!--MS:<PageFieldFieldValue:FieldValue FieldName="fa564e0f-0c70-4ab9-b863-0177e6ddd247" runat="server">-->
    <!--CE: End Page Field: Title Snippet-->

In MSDN docs you can find this explanation of the comment tags above:

A snippet contains four basic sections:

Header with starting <div> and <!--CS> tags (except custom ASP.NET snippets, which are not wrapped in a <div> tag)

SharePoint markup where snippets are enclosed in <!--MS> start and <!--ME> end tags

HTML preview enclosed in <!--PS> start and <!--PE> end tags

Footer with closing <!--CE> and </div> tags.

  • Please explain why the MS/CS/ME/SPM stuff on each row?
    – Jussi Palo
    Sep 17 '13 at 11:01

In regards to adding a page title directly on a html page layout, the following code works when you place it anywhere within the content placeholder PlaceHolderMain.

<!--MS:<SharePoint:FieldValue FieldName="Title" runat="server"/>-->     

All @robertLingren was very close re the site title. For the layout pages you can use aspx markup but you need to wrap in the MS markup syntax - the code below I have tested and it works

<!--MS:<SharePoint:ProjectProperty Property="Title" runat="server" />-->
  • The question is about page layouts though, but great input for layout pages May 7 '14 at 11: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.