Pages

Tuesday, September 30, 2014

How to change a Title of a wiki page in SharePoint 2013 without affecting its page name and page URL

How to change a Title of a wiki page in SharePoint 2013 without affecting its page name and page URL

Please also see my new post on - Easy Way To Change Wiki Page Title In SharePoint 2013 .

In a SharePoint wiki page, if we would like to change the “Title” of a page, we would have to change the “Page Name” itself. This becomes very irritating because if we want our page title to be named as for example “My Page Title”, this will also rename the page name.

Questions comes how to get rid of it.

There are 2 ways. Both requires some coding.

    1. Using SharePoint Designer 2013 and modifying "EnterpriseWiki.aspx"
    2. Using JQuery script, in case EnterpriseWiki.aspx is not available
  1. Let’s see how we can change the page title of our wiki page using SharePoint designer:

This solution involves two small code changes and a new Authoring habit.

  • Open the site in SharePoint Designer 2013, and open this: /_catalogs/masterpage/EnterpriseWiki.aspx
Note: It is a good idea to make a copy of this file somewhere.
  • Find the content place holders with IDs PlaceHolderPageTitle and PlaceHolderPageTitleInTitleArea.
  • Edit the SharePoint:ListItemProperty  for both content place holders by adding a new property called Property with the value of Title.


  • Next, find the SharePoint:FileField control with ID PageNameInEditMode
  • Add the following code just below that line:








It should look like this:

  • Save and close.
Now the page will display the Title property instead of the Name (i.e., file name). The edit form will show both the Name and the Title (similar to list view edit forms). You can test it by changing the Name of a page and then looking at the displayed Title and tab Title compared to the URL. 

  2.  If you don’t see “EnterpriseWiki.aspx” page, don’t worry, we can add JQuery script to our Wiki page to change the title. Let’s see how this can be done with JQuery:

  • Open your Wiki page and click on “Edit Page”
  • Add script editor web part and in script editor web part, just add below script:

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#DeltaPlaceHolderPageTitleInTitleArea > span > span > a").text("My Page Title");
    });
</script>

  • Save and Close the Edit mode of the page and you will see the title as changed
Hope this will help many of you.

Read More »