Is there a way to tell if the current page is a node? Without checking the URL I would like to know if the current page is a node page.  We plan on using URL aliases so we would like to not rely on the '/node/*' structure.

Is there some page variable or something that will indicate a node page?
\Drupal::request()-&gt;attributes-&gt;get('node');


Taken from here: https://api.drupal.org/api/drupal/core!lib!Drupal.php/function/Drupal%3A%3Arequest/8

Now the docs say to never use this function, but I have used this to determine what kind of page I am on.

There is another function, but I am not sure it applies in your case:

https://api.drupal.org/api/drupal/core%21modules%21node%21node.module/function/node_is_page/8

At the very least, if you do not have an entity, you could mimic that in your code:

  $route_match = \Drupal::routeMatch();

  if ($route_match-&gt;getRouteName() == 'entity.node.canonical') {
    return true;
  }