I would like to set the URL patterns in such a way that the page name of the parent page gets inserted into the URL. For example, in the Main Menu I've got an "About Us" link (about-us) and I would like to create a child page Contact Us (contact-us) underneath it.

How do I set up the URL alias patterns so that the child page URL is automatically set to about-us/contact-us?


URL aliases is supported in Drupal by help of pathauto module; if you enable the Token module, you can use it efficiently by using tokens. Once these modules are enabled, you can visit admin/config/search/path/patterns to set the patterns for URLs.

But as I see in your question, you are looking to set this for menu; you can't do that here.

There is logic behind it for not supporting it. Suppose you have a node/18 for about-us and you have two menu 'About-Us" & "About-Company". Now you can add this same node/18 to both places as child.

How can you have two URL aliases for single node/18? So this is the reason why menu are not supported I think.

You can go for creating content type & use pattern for that. You can set pattern for taxonomy, users, etc.

  • Thank you @RajeevK Pathauto is the module I was looking at and trying to set the path. But couldn't get it to work, or rather for it to detect the parent... – user19417 Aug 5 '13 at 5:48
  • @user19417 I have explained it in my answer. You can set for content & taxonomy. Not menu which you are looking for.. – RajeevK Aug 5 '13 at 6:06
  • So other than setting up taxonomy terms/vocabularies, there is no other way? @RajeevK – user19417 Aug 5 '13 at 6:39
  • @user19417 - You can set for CONTENT TYPE & in most of the scenario this solve the problem.. – RajeevK Aug 5 '13 at 6:40
  • 1
    The Token module is one of the dependencies of the Pathauto module; you cannot enable the latter without enabling the first. As for having more than one path alias that points to the same internal path, that is possible: I could set about-us, and our-company to both point to node/18. – kiamlaluno Aug 5 '13 at 8:04

I can’t check right now, but I remember having used such a pattern. AFAIK you should find corresponding tokens in the Token module. According to this issue, check for [node:menu-link:parent:url:alias] (in Drupal 6 it seems to have been [menu-path-raw] for the whole path).

The module Pathauto Menu Link seems to be useful when you use such a pattern, as it updates the aliases when the menu items are moved.

The module Menu Trails (for D6) allows "the menu trail to be used in automatic path alias creation".


I know this is an old post, but for people looking for an answer in DRUPAL 8 this is a way you can do it.

Pathauto is what you are looking for. It allows you to create paths for content types as well as subpages for each page of that content type using taxonomy definitions. You may want to become more familiar with path auto if you haven't used it before because it can be very powerful.

Here are the basic steps:

  1. Create your content type
  2. Create your taxonomy with pre-defined values (or not, up to you on how it behaves) for each page of the content type
  3. Create secondary page content type
  4. In secondary page, create field for entity reference to the taxonomy you created
  5. OPTIONAL: Hide this field from display
  6. In pathauto, use the tokens to drill down your path (example: [node:field_taxonomyname:entity]/[node:title])

Since Drupal 8 is so new you may need to play with your options because each sites definition of taxonomy could be very different, but always make sure to clear your cache before deleting/generating aliases.

There is also a great video I found that walks you through how to do it: https://www.youtube.com/watch?v=D1hEXTC-HV0


This page holds good information on creating url alias in drupal.


Your Answer

