1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Site Title in Masterpage

Site Title in Masterpage

4 posts, 0 answered
  1. WebGeek
    WebGeek avatar
    186 posts
    Registered:
    20 Dec 2006
    28 Mar 2012
    Link to this post
    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. 
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    28 Mar 2012
    Link to this post
    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?
  3. WebGeek
    WebGeek avatar
    186 posts
    Registered:
    20 Dec 2006
    31 Mar 2012
    Link to this post
    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);
    }
  4. WebGeek
    WebGeek avatar
    186 posts
    Registered:
    20 Dec 2006
4 posts, 0 answered