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.

11 comments:

  1. I could not get the javascript to work and the SPD solution is not allowed by my company (no SPD :()

    ReplyDelete
    Replies
    1. What is the error message you are getting?
      Instead of this $("#deltaplaceholderpagetitleintitlearea > span > span > a").text("My Page Title"); line, try to put this $("#DeltaPlaceHolderPageTitleInTitleArea > span > span > a").text("My Page Title"); line.
      Please let me know if this doesn't work either.

      Delete
    2. Javascript code is not working... Can u do changes?

      Delete
    3. Hi,

      I have tested it and it is working absolutely fine.

      Could you please see in Console window of your browser by pressing F12 key if there are any errors you might be getting?

      Delete
  2. Code works perfectly in SharePoint 2013 Foundation! Thank you soooo very much! :)

    ReplyDelete
  3. Here, is my another new post on the same topic which demonstrate another way using JQuery to change Wiki Page Title in SharePoint 2013 - http://sunnybahree.blogspot.in/2016/04/easy-way-to-change-wiki-page-title-in.html

    ReplyDelete
  4. Thank you for the post! This was very helpful and it worked with SP 2013.

    ReplyDelete
  5. The first way doesn't work

    ReplyDelete
  6. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... Best Mountain Bikes Under $500

    ReplyDelete
  7. Thank you for the post! This was very helpful and it worked with SP 2013.
    good money habits

    ReplyDelete