Add site name to page title of each page

Posted by Community Admin on 04-Aug-2018 01:02

Add site name to page title of each page

All Replies

Posted by Community Admin on 15-Jan-2014 00:00
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
Posted by Community Admin on 15-Jan-2014 00:00
Hi Brian,

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

Page.Title = String.Concat(Page.Title, " - Sitename")
Posted by Community Admin on 15-Jan-2014 00:00
Sorry Arno, could you explain a bit more about the page_load. Should I see this somewhere in my master template? Thanks so much.
Posted by Community Admin on 16-Jan-2014 00:00
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.
Posted by Community Admin on 16-Jan-2014 00:00
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
Posted by Community Admin on 16-Jan-2014 00:00
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
Posted by Community Admin on 16-Jan-2014 00:00
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
Posted by Community Admin on 16-Jan-2014 00:00
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
Posted by Community Admin on 27-Feb-2015 00:00

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>

Posted by Community Admin on 09-Dec-2015 00:00
I added Sondre's solution to my master page's .cs file and it works! Didn't work in my master page file directly.
This thread is closed