How to get view name and display ID in template_preprocess_node function
I'm assuming you're using a view page to display your content type:

$route = \Drupal::routeMatch()-&gt;getRouteObject();
$view_id = $route-&gt;getDefault('view_id');
$display_id = $route-&gt;getDefault('display_id');