Now in order to adapt Pathauto's functionality to your own Drupal 8 site's “needs” in terms of url aliases creation, you'll need to configure a setting or two (or three). Note: while you should check this particular box for new content, you might need to manually enable it for the already existing contentĤ. once unchecked, you get to override the automatically generated one and to replace it manually with your own custom alias.once checked, it will automate aliases based on that specific pattern that you will have defined. Now that you've defined your custom pattern you'll notice a new checkbox “popping up” in your “URL path settings” field, on the right side of your content form: the “Generate automatic URL alias” one. Step 5: Type “Article” into the “Label” field Step 4: Select “Article” as your “Content type” (this way you're setting up that this specific custom pattern should get applied exclusively to the article content types on your Drupal 8 site) Step 3: Choose “Content” from the “Pattern type” drop-down menu that you have there and then just enter your “article/” pattern into the “Path pattern” field on the same screen Step 2: Just give the “Add Pathauto pattern” blue tab a click Step 1: Configuration “URL aliases” > click the “Patterns” tab What the Pathauto module will do is make it look less “generic” by naming it: it will replace the part with the article's title itself.Īnd now, here's the step-by-step guide to follow for defining your own patterns as you generate automatic URL aliases in Drupal 8: Here's an example of an URL pattern: article/! Since, as you well know it, aliases rely on pattern systems, it's you, the site's administrator/developer, that get to define these specific patterns and, thus, the aliases' structures. or directly from your content edit form: click on “URL path settings” (you'll find this field, as shown in the image below, at the edit form's right side) and simply enter your path into the “URL alias” field there you can create them from your “URL aliases” page: Configuration > “URL aliases” > “Add alias”ī. So, back to our sheep: we're manually creating our URL aliases.Īnd how do we do that? Luckily we have (again) 2 options to choose from (don't you just love it how there are always at least 2 ways of getting things done in Drupal?):Ī. The Drupal core module Path can “handle the job all alone” (Pathauto will just come, subsequently, to automate the whole creation process, get it?). At least not at this stage, when you're just creating your URL aliases. You don't need to harness Pathauto's power. Now It's Time to Create Your URL Aliases (“Manually” This Time) Next, just run a quick check-up (simulating that you add a new piece of content) just to make sure that everything's working smoothly: go to Content > Add content and just select a content type from those listed there!Ģ. or enter the following commands in Drush: $ drush dl pathauto token ctools enter the following command if it's Composer that you prefer: $ composer require drupal/pathautoī. The “trio” you'll need downloaded and enabled on your Drupal 8 site before you can even consider switching your attention to creating aliases and defining Pathauto's custom patterns.Īre you a Drush “addict” or a Composer fan? For you get to choose from these 2 methods for installing these key 3 modules:Ī. First Things First: Install and Enable the Due Modules “dusty” old practice), I'll show you how you can harness precisely its “automation” superpower!ġ. That Pathauto should be an essential module in your “emergency toolkit” as a Drupal developer is no news for you, right? Just imagine how the sites that you work on would look like and what ranking performance they would “score”, on a long term (not to mention the impact on the overall user experience, as well), as some “clusters” of “/node/xxx” URLs.Īnd since the Pathauto module comes to turn generating URL aliases into an AUTOMATIC process (since “manually” creating each and every path alias, for each and every type of content on a given Drupal site, is such a. That Drupal core supports URL aliases in core is no news for anyone, but you still might be having some unanswered questions on how to generate automatic URL aliases in Drupal 8, right? Automatically creating URL slugs is the norm nowadays! This is precisely why I've done my best to put together a step-by-step guide for you on how to leverage the Pathauto module's full functionality on your Drupal 8 site and therefore automatize the whole path aliases creation process: Don't you just hate the "/node/007" type of “Drupalish” URLs? They say nothing to Google's bots and they sure look as some discouraging hard-nut-to-crack enigmas to your site visitors, too.
0 Comments
Leave a Reply. |