After creating a Web Template the pageTitle becomes hidden, how can i access pageTitle from onet.xml

sharepoint.stackexchange https://sharepoint.stackexchange.com//questions/88561

  •  10-12-2019
  •  | 
  •  

Question

I have created a Web Template but I haven't quite gotten my head around the Onet.xml file. I've Added some custom Web Parts and basically done most of the things that people suggest one would configure in the <Configuration> part of the onet.xml file.

The customization's all work and I can use the Web Template when creating sub sites. The problem comes when the sub site have been created.

The problem: The site have been created but the Title on the page isn't displayed.

When using Chrome Dev Tools:

enter image description here

When changing the onet.xml file to the #STS onet.xml (team site template's) the title is shown.

Question: I can't figure out why(where) the title is effected by(in) the onet.xml file. Is the page title "added" in the <NavBars> area in the onet.xml file.

Was it helpful?

Solution

<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
         <label class="ms-hidden"><SharePoint:ProjectProperty Property="Title" runat="server"/></label>
</asp:Content>

This is a snippet from default.aspx in C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\SiteTemplates\sts

As you can see, this default page has put the ms-hidden class on the title label. This class has CSS bound to it by default that hides it.

So either you have to create your own default.aspx and provision it, using the markup from C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\SiteTemplates\sts\default.aspx and remove the ms-hidden from the tag. (See here for details about how to provision the default page)

Or you could probably remove the class from the tag with the help of javascript (but that seems a bit overcomplicated and dirty)

OTHER TIPS

jQuery("label").removeClass("ms-hidden");
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top