To have a working code example for the routing approach.
First in MYMODULE.routing.yml
write:
ticket.view:
path: '/ticket/{node}'
defaults:
_controller: '\Drupal\node\Controller\NodeViewController::view'
requirements:
node: \d+
_entity_access: 'node.view'
discussion.view:
path: '/discussion/{node}'
defaults:
_controller: '\Drupal\node\Controller\NodeViewController::view'
requirements:
node: \d+
_entity_access: 'node.view'
Then in MYMODULE.module
you'ld add template suggestions like so:
/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function MYMODULE_theme_suggestions_node_alter(array &$suggestions, array $variables) {
if (\Drupal::routeMatch()->getRouteName() == 'ticket.view') {
$suggestions[] = 'ticket'; // Would take ticket.html.twig
}
if (\Drupal::routeMatch()->getRouteName() == 'discussion.view') {
$suggestions[] = 'discussion'; // Would take discussion.html.twig
}
}
Or maybe if all it takes are some different styles simply add a body class depending on the route:
/**
* Implements hook_preprocess_HOOK().
*/
function MYMODULE_preprocess_html(&$variables) {
if (\Drupal::routeMatch()->getRouteName() == 'ticket.view') {
$variables['attributes']['class'][] = 'ticket';
}
if (\Drupal::routeMatch()->getRouteName() == 'discussion.view') {
$variables['attributes']['class'][] = 'discussion';
}
}
Last but not least check out this brilliant article https://thinkshout.com/blog/2016/07/drupal-8-routing-tricks-for-better-admin-urls/, there are some more route goodies inside you may like.