In this tuto, I'll show you how to get the route name of the current page in Drupal 8.
To get the current route name, use:
or
To check if the current page is a taxonomy term use:
To check if the current page is a node, node preview or node revision use:
To check if the current page is a contact form page use:
To check if the current page is a view page use:
The route names from views are built like this view.[view_name].[display_id].
List the existing routes:
You can list the existing routes with Drupal Console:
drupal router:debug