How to disable Creating Friendly URLs for New Pages behavior in SharePoint 2013 / Office 365 using JSOM


I was trying to apply a filter in a Search Result Web Part in order to display items that match only with a specific content type and belonging to a specific sub site. It was annoying to me that the property Path neither the property ParentLink worked as expected. As many times, the search engine just returned 0 results.

This was the filter used in Query Tool: Path:{Site.URL}

Talking with my friend Ben about the scenario we are trying to figure out why. Finally we noticed that OOB in SharePoint, when create a new Publishing Site Collection or Enterprise Wiki Site Collection (or custom WT inheriting in these), automatically the Manage Navigation is configured and with this one “Create friendly URLs for new pages automatically” option.

SPO Navigation settings

Navigation by default enables the options:

So, If you are in the scenario in which you need to do some filter using Site-scoped pages or do you prefer not enable the friendly urls in your sites, then you should disable the Create friendly urls option.

Is possible to solve declaratively?

For now, there is no way to solve this in a declarative way (using XML files or Onet.xml configuration). So, to solve that we are going to apply some JSOM (JavaScript) code to configure it accordingly.

We should use this object in JSOM classes: > SP.Publishing.Navigation.WebNavigationSettings:

The exact method is SP.Publishing.Navigation.WebNavigationSettings.set_createFriendlyUrlsForNewPages(value)


This is the code to disable the Create Friendly URLs for New Pages behavior:


Author: José Quinto
Copyright Notice: All articles in this blog are licensed under CC BY-SA 4.0 unless stating additionally.