Facets allow users to search the site based on selected criteria. Using Facet API module we can add facets on site. For each field that is indexed, we can have facets. These facets can be configured and displayed on search pages. We have various configuration options available for this.
Many times we need to show these facets on pages that are not Search pages. Facet API module does provide this functionality. You need to create a view display of type “Facet blocks”. Below are the steps to do so.
1 – Create a view of search index and a display of type “Facets Block”. You can make this display in the same view as the search page.
2 – Configure “Facet field” and “Search page path”. Search page path is the path of the search page.
The block is then available to be assigned to the region in blocks page.
However, there are several limitations to this:
- The facet links will always be styled as a list, no rewrite or format selection is possible.
- It is also not possible to use the normal Facet API widgets for these facets. This is because re-using the Facet API components from outside of the Facet API cannot be easily achieved.
In many cases, Professional Web Development need to show facets on the non-search pages as normal facets instead of the list. To achieve this, follow steps below:
- Create a facet block as mentioned above.
- Show this block on the non-search page as usual.
- Make sure that facets blocks are displaying on non-search page as well. Also, make sure that facet block is showing above views facets blocks i.e weight of facets block is higher than the views facets block.
- Edit the facet block and set “Display for searches of facets” to “All search page”.
Doing this will make both the blocks visible on the non-search page. You can hide the block showing list using CSS. This solution works for Search API Database Search and Search API Solr Search.
The final result is something like this:
Read more Blogs https://goo.gl/jhRmqR