John Chapman

SharePoint 2007 – JQuery to Fix Ugly Page Titles

Share on TwitterShare on LinkedInShare on TumblrSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to reddit

One thing that I have always found quite annoying in SharePoint 2007 is that content page titles are ugly.  For instance, if I create a new Web Part Page and give it the title “My Blog” with the URL “/pages/my_blog”, the title of the page in the browser ends up being “Pages – my_blog”.  Quick ugly and not very user-friendly.

One solution to the issue that I have been using is setting the page title using JQuery.  I have the JQuery library referenced in my Master Pages and I add the following into the Edit Source view of a blank Content Editor Web Part:

<script type="text/javascript">
	$(document).ready(function() {
		document.title = 'My Blog';
	});
</script>

Just note that this does not affect how search engines see the title of the page. Since they do not render the JQuery, they will still see the “Pages – my_blog”.

Share on TwitterShare on LinkedInShare on TumblrSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to reddit

John Chapman

Hello, I'm John Chapman. I am a SharePoint developer living in Mesa, Arizona. I develop solutions using ASP.NET, C#, jQuery, SQL, SharePoint, etc, and I thrive on the challenge of writing code to overcome the impossible, annoying, or otherwise difficult obstacles.

Website - Twitter - More Posts

2 Comments

  • Do you really want to add a Content Editor to every page?

    • No, not at all. This is more of a one-off thing. If this needed to be accomplished on all pages, I would write a custom solution that adds a “Page Title” column to the pages library and set the page title programmatically using the AdditionalPageHead control.

Leave a comment

John Chapman