In SEO, we often talk about creating the right slug for a page. Of course, we’re not talking about the slimy creature that eats your plants. So, what is this ‘slug’, then? And why should you optimize it? In this post, we’ll explain all you need to know about it.
What is a slug?
A slug is the part of a URL which identifies a particular page on a website in an easy to read form. In other words, it’s the part of the URL that explains the page’s content. For this article, for example, the URL is https://yoast.com/slug, and the slug simply is ‘slug’.
Here’s how Joost explained slugs in an Ask Yoast video:
In WordPress, the slug is the part of your URL that you can edit when writing a new post. Note that this only works with the right permalink settings. Editing your slug in WordPress looks like this:
Things like the date or category name that are sometimes included in URLs, aren’t part of the slug. And if you have added more variables to your URL, the slug is still just that editable part of the URL to the page, like this:
There’s an additional value at the end of that URL. In this case, that extra variable is used so slugs can be the same without the URL being the same.
Slugs and SEO
Writing a good slug for your page or post can positively affect your SEO. It allows you to do the following things:
Include your keyword in the slug
The main SEO benefit of a slug is that you can change the words to make sure that it has the words that you really want to rank for. It’s one of the indicators Google uses to determine what a page is about.
Create user friendly URLs
The URL is also one of the things that people see in the search results. Picture a results page: you’ll see many different URLs about a certain topic, right? So you need to make sure your slug is in line with what people expect to see. For example, our main article on WordPress SEO has the URL yoast.com/wordpress-seo, which is very on point. People are a lot more likely to click on that, than on yoast.com/?P=613458, even though that’s the slug that WordPress creates by default.
How to optimize your slug
What are the things you need to think of when constructing the right slug for your post or page? Let’s go over four steps of optimizing your slug:
Include your keyword in the slug
This is probably a no-brainer, but for the record: your keyphrase should be in the slug. It has to make clear what your page is about immediately.
The SEO analysis in the Yoast plugin will show this message if your keyphrase isn’t in the slug:
- Think about function words
The slug that’s generated by default may include function words like “a”, “the” and “and” and similar words. In some cases, you might need those in the slug to clarify what your page is about, but usually, you can leave them out. We have written a tad bit more on these words in our WordPress SEO article.
- Add focus
Don’t just filter out unnecessary function words, but really all the words that you don’t need. In the case of this post, WordPress automatically created the slug “what-s-a-slug-and-how-to-optimize-it” (based upon the permalink settings in WordPress). That’s quite long, so I manually reduced it to “slug”. Make sure the slug still makes sense, though.
There is one thing to keep in mind here. You can use a slug only once, so you should use it for the right page. For example: the slug for this article is ‘slug’, which is very specific. Now, we’re not going to write another article with “Slug” as a topic. This informative article is the central point for information about slugs on our website. But if this were just an additional post, and we were planning to write a main article later, we’d have a problem. You’ll understand why: because the slug “slug” would already be taken. So, do consider the page’s level or position on your website.
- Keep it short and descriptive
The URL of your page is shown in Google search results. Not always, sometimes it’s for instance replaced with breadcrumbs (awesome). Don’t include too much information if you intend to reuse the URL for article updates. Be careful adding dates and such to your slug, as these will instantly give away when content was originally published.
For example: in the image, you can see an article the title mentions 2018, but the slug doesn’t. That makes for easy updating so the article is still valid in 2019 and on!
Another reason to keep it concise: a short slug, that comes right after the domain, allows Google to show keywords in its mobile search result pages as well.
A word of warning: it’s best to take these steps before publishing your post. If you think of a better slug after publishing your post, it may be tempting to change it. It’s just so easy, right? But beware: doing this means changing the URL and to avoid 404 errors, you’ll need a redirect. If that’s a problem, check out the redirect manager in Yoast SEO premium. It’ll instantly pop up so you can easily create one!
Conclusion: Your site needs good slugs
There it is! Now, you know what a slug is and what it can do to help your SEO. So, from now on, optimize your slugs with these four things in mind!
Read more: WordPress SEO: the definitive guide »