It seems just yesterday I wrapped a simple Drupal tutorial on how to enable pretty URL's for Drupal 7 site. Turns out already three years have passed. Time flies, newer versions of Drupal emerges, but the question remains pretty popular. I could point you to the previous article, but things have changed a little bit in Drupal 8, thus the principles stays the same.
Today I will provide a simple tutorial on how some (perhaps you) can enable pretty URL's for Drupal 8 site.
One of the most common Drupal tasks is to setup - Drupal friendly URL's - friendly both for humans and SEO. In fact - friendly URL's have been one of the main SEO strategies for the past decade (at least).
Default Drupal path structure is like this - node/4803, which is nice - but if you would like to convert node/4803 to /my-awesome-title, you will need to download and enable Pathauto module.
- Download Pathauto module (with it's dependencies - Ctools and Token modules)
- Extract them to /modules folder
- Enable Pathauto from Extend section (admin/modules)
Installing Pathauto module for Drupal 8
Once you are done with the technical stuff, visit Patterns page (admin/config/search/path/patterns) and click on the Add Pathauto pattern.
- From the Pattern type drop down menu choose: Content
- Path pattern: [node:title]
- Content type: Select all which applies
- Label: Give it a nice name, for example NODE URL
Configuring Drupal 8 patterns
Click on the Save button, and lets proceed with generating new URL alias.
Click on the Bulk Generate tab (admin/config/search/path/update_bulk), and select types of paths to generate alias, in this case I have created the pattern just for Content, so I will check next to the Content.
Bulk generate URL aliases
Click on the update and wait for URL aliases to be populated. Congrats, you have just enabled Pretty URL's for your Drupal 8 site.
Following patterns can be used (or browse through available tokens and configure your own)
- [node:title] - for Default path pattern
- topics/[term:name] - for default path pattern for all tags