CERN Accelerating science

Close menu

Paths and menus

All Drupal nodes have a specific default system URL when they are created. For example, the user URL pattern is /user/<user_id> and when a node of any type is created the URL pattern is /node/<node_id>. It is highly recommended to mask the paths of your website by creating aliases that are applied on top of the system paths. The aliases are useful for the following reasons:

  • If the URL pattern is descriptive, then it is easily memorised.
  • Text-based URLs are better for Search Engine Optimisation they include words, which are easier indexed by search engines.You can see all the aliases by visiting /admin/config/search/path. 

An automated way for masking the system paths is by creating your own custom URL patterns. For the creation of your patterns, we propose the following suggestions:

  • When you create a content type, it is recommended to keep the same path pattern for the nodes of the same content type. For example, if you have a content type called Article, you can create a pattern for this content type which will follow the following pattern /article/<title_of_the_article>. As a result, when you create a node of type Article, for example an article entitled “Latest News at CERN”, the URL of the node will be: /article/latest_news_at_cern. 
  • If you tag your content with taxonomy terms to categorise them, it is better to include this taxonomy in the URL. This way, the URL will be even more specific and easier memorised. For instance, if you have an articles’ category called “Experiments”, you can specify the content being tagged with this category to appear in the URL. In the end, the URL will be /article/experiments/latest_news_at_cern.

Of course, you can use whatever name you prefer, since the path “/article/” and “/experiments/” were used as examples.

How to create a path pattern

Path patterns are generated by the Pathauto module. When you create a CERN website, by default the Pathauto module is installed but not enabled. As a result, in order to start creating and generating paths, you first need to enable the module and clear the caches. If for any reason the module is not installed, you can always find it in this link ( In order to create a path pattern in Drupal 8, you first need to visit /admin/config/search/path and click on the “Patterns” tab and follow the following steps:
[In the following steps we assume that we create a pattern for the “Article” content type]

  1. Click on “Add pathauto pattern”
  2. Fill the fields
    1. Pattern Type: Select a pattern type which can be either content, taxonomy term or user.
    2. Path Pattern: Enter the path pattern that you wish the nodes of the content type(s) to have. You can also use tokens, which have the ability to take a dynamic value (You can check the available tokens by clicking “Browse available tokens”).
    3. Label: it with a descriptive name in order to be more visible within the list of patterns. In our case let’s name it “Articles’ pattern”.
    4. Language: check the language that you want this pattern to be applied. This option is useful if you want different words for different languages.
  3. Done!
Path patterns

How to generate paths for the entities

Having created the desired patterns for your content, taxonomy terms etc, you can then generate the aliases for of the entities. In order to do this:

  1. Visit again /admin/config/search/path/patterns
  2. Click on Bulk Generate
  3. Fill the fields of the form
    1. Select what types of paths you need to generate: content, taxonomy terms or users. The generated paths are of course based on the created patterns of the previous section.
    2. Select which URL aliases to generate: The available options for this case are:
      1. Generate a URL alias for un-aliased paths only: Using this option will generate an alias only for the system paths that are not already masked with an alias.
      2. Update the URL alias for paths having an old URL alias: Using this option will generate an alias only for paths that are already masked. It will not generate for system paths that do not have a mask
      3. Regenerate URL aliases for all paths: This option will regenerate URL aliases for both unaliased and already aliased system paths. 
  4. Click on Update and...Done! Make sure you clear the caches after the generation.

Related FAQs