2.1 Permalinks, Slugs, and Links
1.Introduction1 lesson, 00:51
2.Introduction to Permalinks2 lessons, 09:01
3.Optimizing Permalinks in Your Site2 lessons, 15:42
4.Conclusion1 lesson, 02:44
2.1 Permalinks, Slugs, and Links
Hello, and welcome back to this Tuts+ course on WordPress permalinks. In this part of the course, I'm gonna show you the difference between a permalink, a slug, and a URL. So the permalink is a term used in WordPress to refer to the unique link for each post or page, or basic content of a custom post type in your site. And in your theme, you'll find that this function here, the permalink, is used in the loop to refer to the link to an individual post. So that's used in the loop on an archive page, or on the homepage, or the main blog page. And what that function does is output the unique link to that post so that the user can then click on it. Now it doesn't matter how you have your permalinks set up and what your URLs are looking like. This will always work because it uses the unique ID of the post to fetch that permalink and to display it correctly as it's currently configured in your WordPress site. So that's what a permalink is. And you can configure the way your permalinks are set up in WordPress via this permalink settings page, which I'll show you in a bit more detail. We've then got the URL. So here's a post on my site that I'm gonna be demonstrating within this course. The URL consists of two things. First is the domain name, which here is compass-hosting.co.uk/demo because this site is actually on a subdomain of my main compass-hosting domain. And then this part, the very last part of the URL is what's called the slug. And the slug is unique to the individual post. So you can see here that this slug is based on the title. The WordPress will automatically generate that slug based on the title that you input for the post. So the URL consists of the domain name and the slug, but it will also sometimes consist of something else in between. So there might be something like the name of the category, or blog, or something like that, and we'll see that as we go through the course. So we've got three terms. We've got the permalink, which is the unique link to an individual post or page. We've got the URL, which is the full URL, I'll click on that, you get the whole thing. And that is what you would use if you're sharing that post via social media or in an email, for example. And then we've got the slug which is the very last part of the URL, which is unique to the individual post or page. So let's take a look at it in another one of my sites which uses a slightly more straightforward domain name. This is learn-wp.net. So this is the URL and the domain name because we're on the homepage. But if we go into the blog, you can see we've got blog here as the slug because that is for this specific page that I've created to hold my blog posts. And then if I go into one of those posts, my URL consists of three things, the domain name, the category that this post is in, and then quick-guide-to-activating-wordpress-multi- site, which is the slug for this individual post. And in this site, I've configured my permalinks to include the category before the name of the post. And you can do that if you want to or you can choose to have nothing there. So it would just be learn-wp.net/quick-guide-to-activating-wo- rdpress-multisite/ or you could have something like blog, and you could use that for all of the posts, not just once in a specific category. So if I go to another category, we can see here that I've got learn-wp.net/topics, and then ultimate which is the slug. Ultimate is the name of my category, but I could edit that if I wanted to for my category. So I've chosen to have topics here instead of category, which is the default. And again, I'll show you that as we work through the course. And if I look at one of the posts in here, it's learn-wp.net/ultimate/advanced-wordpress-- for-professionals. So I've chosen to include these words because they'll help my SEO and my user experience. You might choose not to use them so that you can have shorter URLs, because UX short URL's generally good. And in the next part of the course, I'll show you exactly why optimizing your permalinks in WordPress is good for your search engine optimization and your user experience. See you next time and thanks for watching.