Site Title in Masterpage

Posted by Community Admin on 03-Aug-2018 20:21

Site Title in Masterpage

All Replies

Posted by Community Admin on 28-Mar-2012 00:00

In sitefinity 3.7, I had a solution that would allow me to set my site title (name of company) in the code-behind of the masterpage and on-load it would render the current page title (from sitefinity) and the company name and location.

For Example:
About Us - Company Name - Location
Services - Company Name - Location

How would I go about doing this in SF5?  I am using a custom masterpage. 

Posted by Community Admin on 28-Mar-2012 00:00

Master pages in Sitefinity should still work as they always have, so if you have code-behind in your master page that modifies the Page Title, it should still do so.

Have you tried doing it already and are encountering issues?

Posted by Community Admin on 31-Mar-2012 00:00

In 3.7 I used the following code in my masterpage.  It does not work in SF 5 - any suggestions?

protected string GetPageTitleFromNode(CmsSiteMapNode GetCmsPage)
  
if ((GetCmsPage != null) && (GetCmsPage.ParentNode != null) && (GetCmsPage.Title != "Home"))
  
return GetCmsPage.Title + " - " + GetPageTitleFromNode(GetCmsPage.ParentNode as CmsSiteMapNode);
 
  
else
 return this.SiteTitle;
  
  
protected override void OnPreRender(EventArgs e)
 // Sets the Page Title
  
CmsSiteMapNode GetCmsPage = SiteMap.CurrentNode as CmsSiteMapNode;
Page.Title = GetPageTitleFromNode(GetCmsPage);
 
base.OnPreRender(e);

Posted by Community Admin on 31-Mar-2012 00:00
This thread is closed