Changing aliases for nodes in Drupal 8

When working with your nodes (content unit such as Articele, page, etc), they are assigned a default node identifier. This identifier becomes part of the URL that specific page. For example, the first node you create, whether it be an Article or a Basic Page, the identifier will be /node/1 as it is the first content node created. Subsequent nodes are always numbered sequentially so the next one would be node/2. The URL for the first node will be https://example.com/node/1. This is not very descriptive, however. You may wish to have more descriptive identifiers in the URL, such as https://example.com/firstpage. This can be done by creating an alias. The alias can be customized so that the URL will be more understandable by humans. Below is a guide on how to add custom aliases to your nodes to increase user-friendliness in your Drupal 8 website.

How to change node aliases in Drupal 8

  1. Log into your Drupal 8 interface.
  2. select menu option from toolbar

    Using the toolbar across the top of the screen, click on the Menu link.

  3. select the content menu option

    Another menu bar will appear directly under the first one. From here, select the Content option.

  4. click on the edit button

    This leads you to the main content page displaying a list of all current nodes (basic pages, articles,etc) that exist on your site. Locate the node you wish to work with and click on the Edit link at the end of its respective row under the Operations column. In this example we will select the Introduction page.

  5. enter your node alias

    Now that you are on the content editor page, look to the right hand sidebar and click on the URL Settings category. This will expand the area and allow you to insert your custom alias in the URL alias field. For our example, we will enter the alias intro.

  6. Once you have chosen and entered an alias, click on the Save and keep published button at the bottom of the page. This will activate the new alias for the node. As you can see below, the URL for the Introduction page is now /drupal8/intro, which is more readable and memorable than the previous URL of /drupal8/node/4.

    BeforeAfter
    before the alias is changed

    after the alias is changed

Was this article helpful? Join the conversation!