You might be familiar with metadata navigation in SharePoint – a handy feature that allows users to more easily find items in large lists/libraries using configurable filters. We activated/configured metadata navigation and were able to use this feature using both of the out-of-the-box masterpages (Seattle and Oslo) and for a while all were happy in SharePoint-land.
Until one faithful day we decided to copy the Oslo masterpage we were using at that point and customize it. After our changes we found that the metadata navigation pane was missing. After some investigation it turned out that even if we edited the default Oslo masterpage the filters would still be gone. The Seattle masterpage did not suffer from this problem: no matter if we copied it or modified the original version the filters would still be on the page.
To explain why this happens I’ll have to take a small step back and briefly talk about the SharePoint publishing features with regards to masterpages:
- Normal, non-publishing, sites only have a single file per masterpage, which has the .master extension (e.g. Seattle.master, Oslo.master, …). This file can be edited directly using SharePoint Designer or any other editor.
- Publishing sites have two files per masterpage, one .master file and one .html file (e.g. Seattle.master and Seattle.html). The .master file can no longer be edited directly but will be generated by SharePoint whenever the .html version is updated.
Turns out Oslo.html does not contain the snippet for the “TreeViewNavigationManager”, the control responsible for adding the filters to the page. The Oslo.master file however does contain this snippet. This is why the filters were there when we first activated the Oslo masterpage but stopped showing up as soon as we copied it or made any customizations: SharePoint would parse the .html file and ‘translate’ it into a new version of the .master file, this time without the “TreeViewNavigationManager”.
Once we found out what the problem was we were able to easily fix it by adding this snippet to our copy of the Oslo.html file (I advise against editing the out-of-the-box masterpages and prefer to work with copies), just below the “sideNavBox” tag.