I use Views Ajax history so that customers keep track of a search when they navigate from a view with exposed filters to a product, and then back to the view.

But in other parts on the website, this generates unwanted things, such as node?page=1 / node?page=2 and so on at homepage, whenever using pagers of blocks views.

I performed a huge SEO audit, where these paths are pointed as undesirable, also when you go back with browser buttons it can take 10 clicks before you reach precedent page, not very UX friendly.

But after thinking about it, I really don't know how I could limit ajax history to my products views. Any suggestion welcome !


My bad, Views_ajax_history is such a minimalist module in fact !

To avoid hacking it, hook_js_alter did the trick :

 * Implements hook_js_alter().
function example_js_alter(&$javascript) {

  if(arg(0)!='taxonomy' ) {//my products views are taxonomy lists

    $history_js = libraries_get_path('history.js') . '/scripts/bundled/html4+html5/jquery.history.js';
    $views_ajax_history = drupal_get_path('module', 'views_ajax_history') . '/views_ajax_history.js';
    $views_ajax_history_2 = array('viewsAjaxHistory' => array('onloadPageItem' => isset($_GET['page']) ? $_GET['page'] : 0));



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.