Move Managed Metadata Navigation location in SharePoint 2013

Author by Steve Borgwardt

While working on a project recently I noticed that by default when you enable and turn on Metadata Navigation under List Settings -> Metadata navigation settings, it will render the navigation hierarchies (term sets) and key filters at the bottom of the left navigation menu under you current site navigation.

While in most cases this is fine, there could be a scenario where your current site navigation has many items, pushing the metadata navigation Tree View and Key Filters box far down in the left column that might not be initially visible to the user without scrolling.

With the help of some jQuery I was able to easily move the entire navigation container (term set and key filters) to the top of the SharePoint left navigation container.

Code to move Managed Metadata Navigation location in SharePoint 2013:

Start by going to your list or page and click on the gear icon and edit the page. Then insert a 'Script Editor' Web Part to your page and then edit the snippet and add a reference to jQuery library and then use the following code to grab the navigation container, remove it from the current location in the DOM and insert it above the main left navigation.

<script src="https://code.jquery.com/jquery-latest.min.js" type="text/javascript">script> <script> $(document).ready(function () { $('.ms-tv-box').remove().prependTo($('.ms-core-sideNavBox-removeLeftMargin')); }); script>

The class on the Metadata navigation node is "ms-tv-box" and then we insert it immediately inside the

container for the left navigation by using its class name.

image

Author

Steve Borgwardt

Senior Application Developer