0

I'm trying to set up search-driven navigation for SharePoint Online on my site collection. I'm following this: https://support.office.com/en-us/article/Navigation-options-for-SharePoint-Online-adb92b80-b342-4ecb-99a1-da2a2b4782eb?ui=en-US&rs=en-US&ad=US in order to set it up, but I have questions for some of the vaguer parts.

I've followed through the tutorial, but nothing has changed. I downloaded the seattle.masterand made the changes as described, then renamed and uploaded it. The second part with all the JavaScript was put into it's own file and I linked that in the modified master page file above and uploaded that as well. Should I configure more settings after all of this so that everything works as intended?

My questions is: what else do I have to do to have the navigation work? Below are the code snippets of the affected areas. This is the changed part of the modified seattle.master file:

<SharePoint:AjaxDelta id="DeltaTopNavigation" BlockElement="true" CssClass="ms-displayInline ms-core-navigation" role="navigation" runat="server">
<div id="loading">
  <!--Replace with path to loading image.-->
  <div style="background-image: url(''); height: 22px; width: 22px;">
  </div>
</div>
<!-- Main Content-->
<div id="navContainer" style="display:none">
  <div data-bind="foreach: hierarchy" class="noindex ms-core-listMenu-horizontalBox">
    <ul id="menu" data-bind="foreach: $data.children" style="padding-left:20px">
      <li class="static dynamic-children">
        <a class="static dynamic-children menu-item ms-core-listMenu-item ms-displayInline ms-navedit-linkNode" data-bind="attr: { href: item.Url, title: item.Title }">
          <span aria-haspopup="true" class="additional-background ms-navedit-flyoutArrow dynamic-children">
            <span class="menu-item-text" data-bind="text: item.Title">
            </span>
          </span>
        </a>
        <ul id="menu" data-bind="foreach: children" class="dynamic">
          <li class="dynamic">
            <a class="dynamic menu-item ms-core-listMenu-item ms-displayInline ms-navedit-linkNode" data-bind="attr: { href: item.Url, title: item.Title }">
              <span class="menu-item-text" data-bind="text: item.Title">
              </span>
            </a>
          </li>
        </ul>
      </li>
    </ul>
  </div>
</div>

Where I linked the separate JS file (in the head of the above file):

<SharePoint:ScriptLink language="javascript" name="searchnavigation.js" OnDemand="true" runat="server" Localizable="false" />

And in that JS file, this is the only thing I changed:

var root = "https://company.sharepoint.com/sites/dev.my.name/NavigationBySearch";
0

That article does miss a few of the details. Here are a couple things you may be missing:

The script uses 3 additional javascript libraries jQuery, Knockout and Linq.js. You'll need to download them and add references to those libraries in your masterpage. Something like this:

<script type="text/javascript" src="scripts/jquery.min.js"></script>
<script type="text/javascript" src="scripts/knockout.js"></script>
<script type="text/javascript" src="scripts/linq.js"></script>

Be sure to update the src to be wherever you put them in SharePoint or the CDN url and name of file obviously.

You mentioned that you only changed the root url in the JS to:

var root = "https://company.sharepoint.com/sites/dev.my.name/NavigationBySearch";

This url needs to be the url of the site collection where you want to start searching for sites. That /NavigationBySearch was just the article's name for their site collection. So unless you created a site collection with that name you probably just need to update that url to your site collection url.

After you make the changes, try it out and open your favorite dev tools (F12) and see if you're getting any javascript errors.

Good luck!

  • Thank you! Wow, for the root URL, I thought I had to NavigationBySearch at the end of my own site collection URL. I'm going to make these changes. Thanks a ton. – LaLaLottie May 6 '16 at 14:07
  • Did it work? I'm in the same stage, it's amazing how many steps they skipped while trying to cover and explain everything. – Yugo Jul 18 '17 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.