How to tell if you are on a view page in preprocess_page
That function will error because it does not exist in Drupal 8.

You can do this though:

$view_id = \Drupal::routeMatch()-&gt;getParameter('view_id');
$view = \Drupal\views\Views::getView($view_id);


Be sure to validate view_id first though, that it exists/length before calling the second line.