Drupal 8 get page node current path
snippet in javascript

Drupal 8 get page node current path

user8808

// Get current path.
$current_path = \Drupal::service('path.current')->getPath();
$path_alias = \Drupal::service('path.alias_manager')->getAliasByPath($current_path);