Drupal 8 Basics #17 - Automatic Path Aliases

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey let's AB this is Scot with level up tutorials in this video we're going to be using one of those modules that we installed called a path Auto now path Auto is going to allow us to set up rules to give us nice clean URLs for every single piece of content we create it's a really great handy plugin and one I'm always sure to install it right before I get going on any sort of Drupal site so let's get started right now so now that we have our modules installed we're ready to get started on our Auto path aliases or our path Auto aliases now if you do not have path Auto installed as your module head back to the previous video where we install modules because in that video we installed path Auto token and C tools so if you have path Auto installed we're ready to get started what we can do is now come to configuration let's just click on this link it's going to take us to a configuration page now if we scroll down you'll see URL aliases if we click on URL aliases you'll see the alias we've already created where about us is linking to node 1 so well that's all good what we really need to do is add some automatic aliasing so how do we get to that well we can come back to extend we can look for path out of simply just by searching for path Auto and we can see this downwards arrow here now when we click this you can see there's a configure link if we click configure our going to allow us to get to our configuration now if you wanted to add this to your shortcuts you could come to here if you are planning on visiting here more often it might be a faster way to get here and what you see here is we have a tab called patterns now these are just some patterns for our aliases and we have no patterns yet so let's get started by adding a pattern now a pattern allows us to essentially say well by basically a specific type of content so we'll select content we are able to automatically set the URL so let's say for all articles we want to set the pattern to forward slash post forward slash now we need to browse the available tokens we want the in this particular example we want the current page name now triple essentially refers to pages or articles or anything like that as a nodes so if we click node you can see we have access to all sorts of things including the node title if you click node title it automatically inserts this pattern into our URL path now there's a whole lot of tokens you can use here and they're all going to give you different values but we want our URL to be the title of the node plus the post and we can just save this label as posts so our articles every single article we create now is automatically going to get the path of forward slash post then the nodes title let's click Save so now that we have this in place let's go and click and create a new post when you do content and let's add content and it's going to be an article now in this article we can say our second article and we don't have to do anything in the URL path settings in fact you'll notice it's jet clicked to generate automatic URL alias so we don't want to worry about that and we can just say hello okay so no big deal there no tags no image nothing let's just click Save and publish now here's something interesting we've published our post this post exists as our second article but you'll notice the top the URL path is not node slash 3 however it's post our second article it does everything for us it even does the hyphenating in the title this couldn't be any more perfect I mean now we can reliably know that our post titles are always going to be the post and the title if you had your post as like a category or tag you could maybe potentially have the the category in there or something there's all sorts of different strategies but just sort of keeping your posts and your pages having their own sort of separate pattern is great idea now in addition let's come home let's look at my first edited post if we come here you can still see it still says node /to we don't really want this so let's say we wanted to update this knows URL we can click Edit we can come to URL path settings and let's just simply check this generate automatic URL alias box upon checking that saving and publishing it our post URL is now updated to post my edited post so we've now successfully set that up however we were to create a new basic page let's do content add content basic page we could say new page now this page is still going to get this a note node forward slash 4 so we need to set up another pattern we come back to our patterns we can click Add path Auto option and we can click content once again the pattern is simply just this time let's do browse available tokens I personally don't have these memorized and I always have to come in here and click one so don't worry about that we can click title and now once again let's just click basic page so we can say for all pages once you're created just give the path the title that way we have things like the about Us page would have an automatic path of forward slash about - us so we now have our two aliases setup pages and posts and you'll want to do this for each new content type or things like that that you create so that your URLs are always looking nice and you don't have something like node forward slash 4 let's go really quickly just update this URL alias just so you can see this one in action we're gonna click generate path settings and we're gonna click save and keep published now we can see the new URL is new forward slash page so great this is how you can set up automatic path aliases in Drupal using path Auto module this is something that's been around for a long time in Drupal and something you're definitely gonna want to setup early on in your site's development so as always this is Scott with level up tutorials if you have any questions or comments if you comment the video are me up at Twitter or Facebook I level up tutorials I'd love to hear from you thanks for watching and I'll see you in the next one if you want to purchase entire series or access to streaming the entire series before it's released on YouTube head to store that level up tutorials come and purchase a pro membership or download the series itself for a one-time cost thanks for watching I'll see you the next one
Info
Channel: LevelUpTuts
Views: 12,089
Rating: undefined out of 5
Keywords: drupal, html, web developer, tutorial, css, javascript (programming language), drupal7, development, how to, drupal (software), series, drupal 8, modules, drupal8, composer, develop, developer, theming, tutorials, drupal video, drupal tutorial, web, web development (interest), website, web development, tuts, drupal theming, web application (industry), web application development (industry), web development (project), web developer (job title)
Id: zSErrOFozuM
Channel Id: undefined
Length: 6min 55sec (415 seconds)
Published: Wed May 04 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.