How to Use Pathauto in Drupal 8

How to Use Pathauto in Drupal 8

Many modules have been in flux during the early stages of Drupal 8’s development.

Few modules have changed as much as Pathauto, which the vast majority of Drupal sites use to control their URLs.

In this tutorial, I’ll show you the current way to use Pathauto with your Drupal 8 site.

Before we begin, it’s worth noting that it is much easier to do this *before* launching your site. It’s never easy to change URLs after launch. Also, if you’re using Drupal 7, try our complete video class on using Pathauto.

Video on using Pathauto in Drupal 8

This video is taken from our Drupal 8 classes, available to OSTraining members.

Step #1. Install the modules

You will need these three modules:

Yes, all three are marked as “Alpha”, but that’s the best we have right now.

  • Install and enable those three modules.

Now, let’s see if it’s working correctly.

  • Click Content > Add content and choose a content type.
  • Make sure that the “Generate automatic URL alias” box is checked. This should be checked for new content, but you may have to enable it manually for existing content.

Step #2. Create the Pathauto patterns

  • Go to Configuration > URL aliases > Patterns.
  • Click “Add Pathauto pattern”.

In this example, we’ll create a pattern for our Drupal content.

  • Pattern type: choose “Content”.
  • Path pattern: click the “Browse available tokens” link.

You’ll see a pop-up box with tokens that you can use. For example, if you want to use elements from your content to create URLs for your content, click “Nodes”. Underneath, you will see

In this example, I’m going to use the content type and the Node ID. This will create URLs like this: /articles/1/.

So, in “Path pattern”, I enter [node:content-type] and also [node:nid]. The exact format I choose is [node:content-type]/[node:nid]

  • Content type: Check all your content type boxes.
  • Label: Choose a name for this pattern. Only admins will see this.

Step #3. Generate the URLs

Now we need to generate the URLs for our existing content.

  • Click the “Bulk generate” tab.
  • Check the “Content” box.
  • Click “Update”.
  • Click the “List” tab and you should see your new URL aliases:

Author

  • Steve Burge

    Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.

    View all posts
0 0 votes
Article Rating
Subscribe
Notify of
guest

8 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
jason
jason
8 years ago

how can you use nested terms inside a content pattern within pathauto?

John
John
8 years ago

Thanks for the videos and the post. I am a little confused with the “Make sure that the “Generate automatic URL alias” box is checked.” step. Has this check box gone away with the latest download of Drupal 8? Mine just has a URL alias and a blank box (picture attached). I have learned a great deal in the last week with your Youtube videos. Many thanks.

Louis
Louis
8 years ago
Reply to  John

I have the same issue

all the modules are installed and checked

But there is no Generate automatic url alias checkbox.

robert.kent87
8 years ago
Reply to  Louis

I noticed the same issue. I believe it’s because there aren’t any patterns set up. I created a generic ‘[node:title]’ pattern to use as a default and then the checkbox appeared

Makrotreff
Makrotreff
8 years ago
Reply to  Robert Kent

I have the same issue, but i cant add new patterns because there is only a button with “save order” nothing with add new pattern… wth? “There is no Pathauto pattern yet.” I cant believe that this function is not in D8 core 🙁

hoang phan
hoang phan
7 years ago

this tutorial is very helpful for me. thank you.

Daniel Pickering
7 years ago
Reply to  hoang phan

Thanks Hoang.

Արա Մարտիրոսյան
Արա Մարտիրոսյան
7 years ago

how can I make a path alias for the taxonomy term feeds, I am able to make one for taxonomy terms but not for feeds

8
0
Would love your thoughts, please comment.x
()
x