3

I am using Search API. I make a view of all the indexed entities and uses Taxonomy term as Contextual Filter. But the path of view is not SEO friendly. The path is like http://www.example.com/en/Real%20Estate.

I want to make this path SEO friendly and convert this space(%20) to dash. In views I am getting configuration "Convert dashes into spaces" for contextual filter.

I tried to alter the views and implement hook_views_pre_render, hook_views_post_render, hook_views_post_build and hook_views_post_execute. This time it is not showing the results.

Can anyone help me regarding this?

1
  • Did you find a solution for that?
    – rreiss
    Nov 3, 2016 at 15:18

2 Answers 2

0

Facet Pretty Paths module to the rescue https://www.drupal.org/project/facetapi_pretty_paths

1
  • I think Facet Pretty Paths module is only used to make changes in the parameters of facets in URL. Jun 9, 2016 at 9:33
0

I managed to do that with the following code:

/**
  * Implements hook_views_pre_view().
  */
 function hook_views_pre_view(&$view, &$display_id, &$args) {
   /* Search page view */
   if ($display_id == 'search_page' && !empty($args[0])) {
     $args[0] = strtr($args[0], '-', ' ');
   }
}

You should also adjust the search form ofcourse..

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .