Fixing the titles on wiki pages

Office 365 / SharePoint Blog

SharePoint Online has a bit of a glitch when it comes to creating wiki pages. It doesn’t allow us to change the Title without also changing the aspx file name. If you include spaces, then you end up with %20 in the file name (such as file%20name.aspx), which makes the URL tough to read.

Our guru at work whipped up some specialized javascript code for me today that lets me use underscores in the file name, and then his javascript strips it out. Pretty cool. The code he gave me is shown below

< script type="text/javascript" language="javascript" >
var title_replacement_target = document.getElementById("DeltaPlaceHolderPageTitleInTitleArea").getElementsByTagName('a')[0];
title_replacement_target.innerHTML = title_replacement_target.innerHTML.replace(/_/g, " ");
 < /script >

Just remove the spaces from the < and the >


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s