Do you have a refiner template that shows the refiners based on the hierarchy of a term set, or can you explain how to build it?
These are probably two of the most asked questions I received the last couple of months/years. Back in 2015 I created such a template, but never shared it until today.
The template that is shared renders the following output:
This corresponds to the exact same hierarchy of the term set:
The template only applies a simple styling to indent the children but does nothing more. If you want, you are free to style it to your needs.
Where can you find the template?
The managed metadata template can be found in the SPCSR GitHub repository: Managed metadata refiner.
Things you need to know about the template
There are a couple of things you need to know before you can start using this template.
- You will find
twothree templates in the repository. One for working with the term label value, one to work with the taxId value and one with which you are able to also filter on the parent terms. By default, SharePoint provides you the taxId managed property. But if you follow the best practices for working with managed properties in combination with managed metadata it could be that you configured it to use the label instead. Be sure to pick the right one. - The template requires you to specify the term store ID. This is required for the template to retrieve all the terms from the term set. This is all explained on GitHub, so be sure to go through the configuration steps before uploading the template to your environment.
Updates
23/03/2017
I just added a third template with which you can refine based on the parent terms. Here is an example:
If you compare this one, to the first image at the top. You will notice that Europe is now refinable. When you click on it, it will return all its children, so this allows you to go deeper into the hierarchy.