More in this section
Forums / Developing with Sitefinity / Add site name to page title of each page

Add site name to page title of each page

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
10 posts, 0 answered
  1. Brian
    Brian avatar
    7 posts
    Registered:
    19 Nov 2013
    15 Jan 2014
    Link to this post
    I am using Sitefinity 6.1 and want to simply add the sitename of my website to the page title of each page.

    eg. <title>Page name  - Sitename</title>

    Is there a way to add this inside the master page? I am quite new to Sitefinity and have limited backend experience so any help would be brilliant.

    Cheers,
    Brian
  2. Arno
    Arno avatar
    249 posts
    Registered:
    08 Sep 2010
    15 Jan 2014 in reply to Brian
    Link to this post
    Hi Brian,

    I guess something like this in the page_load of the master page should work:

    Page.Title = String.Concat(Page.Title, " - Sitename")
  3. Brian
    Brian avatar
    7 posts
    Registered:
    19 Nov 2013
    15 Jan 2014 in reply to Arno
    Link to this post
    Sorry Arno, could you explain a bit more about the page_load. Should I see this somewhere in my master template? Thanks so much.
  4. Arno
    Arno avatar
    249 posts
    Registered:
    08 Sep 2010
    16 Jan 2014
    Link to this post
    Hi Brian,

    I assume you have a master page in the Visual Studio project of your website. That's where the page load event can be accessed. You'd best ask a developer to do so.
  5. Brian
    Brian avatar
    7 posts
    Registered:
    19 Nov 2013
    16 Jan 2014 in reply to Arno
    Link to this post
    Yes Arno I have my custom site set up using a master template inside visual studio but there is no reference on this page to page_load that I can add your code. Can you give the full synthax as to how to achieve this?

    thanks,
    Brian
  6. Arno
    Arno avatar
    249 posts
    Registered:
    08 Sep 2010
    16 Jan 2014 in reply to Brian
    Link to this post
    Hi Brian,

    You can try if this works for you (VB.NET syntax):

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
         Page.Title = String.Concat(Page.Title, " - Sitename")
    End Sub
  7. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    16 Jan 2014
    Link to this post
    Hi,

    In my opinion the easiest solution is to drop a javascript widget in your masterpage (screenshot) and write something like this:
    document.title = "My company"+document.title;

    Just do not place it in <head> tag - elsewhere should do the trick (screenshot).

    Regards,
    Vassil Vassilev
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Brian
    Brian avatar
    7 posts
    Registered:
    19 Nov 2013
    16 Jan 2014 in reply to Vassil Vassilev
    Link to this post
    Thanks Guys, thats an easy solution. Don't know how I didn't think of just using javascript. Thought there should be a an option to do something so simple inside the sitefinity control panel.

    Thanks again
  9. Sondre Rivedal
    Sondre Rivedal avatar
    1 posts
    Registered:
    24 Jan 2012
    27 Feb 2015
    Link to this post

    Hi,

    well, the title field is an important piece of information for search engines, and a javascript-based solution will not be visible to the search engine crawlers i guess.

    The "Page_Load" solution in the master file would be better in that respect.

    In the top of your master page you could try something like this:

    <script language="C#" runat="server">
         
        void Page_Load(object sender, EventArgs e) {
            Page.Title += " - Site name";
        }
     
    </script>

  10. Anita
    Anita avatar
    9 posts
    Registered:
    11 May 2015
    09 Dec 2015 in reply to Sondre Rivedal
    Link to this post
    I added Sondre's solution to my master page's .cs file and it works! Didn't work in my master page file directly.
10 posts, 0 answered