I am trying to create a menu item that loads a view mode that calls the callback function with the path alias.

$items['node/%/%'] = array(
  'page callback' => '_node_view_load',
  'page arguments' => array(1, 2),
  'access callback' => TRUE,
  'type' => MENU_CALLBACK

function _node_view_load($node_id, $view_mode = 'default') {
  return drupal_render(node_view(node_load($node_id), $view_mode));

This works if you go to /node/%/view_mode. However, it does not work if you got to /alias/view_mode. I get page not found. Is there a way to bind menu items to path aliases?

  • I would rather use node/%node/%, and the call to node_load() would not be necessary; the last % is a catch-all, and it could match paths already defined by other modules.
    – apaderno
    Apr 28, 2011 at 16:19
  • How did you create the alias? If "test-page" is the alias for "/node/1," when you visit example.com/test-page you will see the content of example.com/node/1, which means the callback associated with "/node/%node" is invoked.
    – apaderno
    Apr 28, 2011 at 18:04

2 Answers 2


You'd have to extend the pathauto system to handle your specific pattern, like it does for node/x/feed items.


I think that the Sub-path URL Aliases module will do what you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.