How to set the Sitefinity Page Title globally for MVC or Webforms

April 28, 2014

Here's a  trick to appending (or prefixing) your domain to your sitefinity site.



Edit the code of your masterpage and paste this in

protected override void Render(HtmlTextWriter writer)
    if (!this.Page.Title.ToLower().Contains( "mysite"))
        this.Page.Title = this.Page.Title + " |";

It wont work if it goes below the base.Render, so keep it above.

I've experimented and this is the safest place to do it as if you try in prerender, then visit a dynamic generated page with the PageTitleMode set to Append you'd get this

<pagename> <|> <dynamicitemtitle>
<pagename> <dynamicitemtitle> <|>

Image Description

Steve McNiven-Scott

Best\Only Blogger on this site. Therefore defacto blogger of the year Award Winner.