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.
Table of contents
- What is a slug?
- How to edit a slug in WordPress
- Why are slugs important for SEO?
- What does the keyphrase in slug assessment in Yoast SEO do?
- How to optimize your slug
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:
How to edit a slug in WordPress
In WordPress, the slug is the part of your URL that you can edit when writing a new post. Editing it in WordPress looks like this:
Note that this only works with the right permalink settings. You can edit the permalink settings in WordPress through Settings > Permalinks. We recommend choosing an option in which the URL contains relevant words, as this provides users and search engines with more information about the page than an ID or parameter would.
Note: don’t just change your permalink settings once your site is already online. This could cause all kinds of trouble.
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.
Why are slugs important for 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 URL
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 URL that WordPress creates by default.
What does the keyphrase in slug assessment in Yoast SEO do?
One of the SEO assessments in the Yoast SEO plugin checks whether the slug contains your focus keyphrase. Your article or page should live on an easy to remember, focused and SEO-friendly URL. To improve the URL, Yoast SEO checks how you’ve fitted in your main focus keyphrase and makes suggestions to improve it.
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 it:
- Include your focus keyphrase
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 it 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 it 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 URL for this article is https://yoast.com/slug/, which is very specific. Now, we’re not going to write another article with the same 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 about this topic later, we’d have a problem. You’ll understand why: because the 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 URL, 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 URL 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.
- Use lowercase letters only
Try to use lowercase letters only in your slug. That’s because, in some cases, you can create duplicate content by mixing uppercase and lowercase letters.
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!
Go Premium to get access to this feature!
Unlock lots of features and get access to all of our SEO courses with the Yoast SEO Premium plugin:
Read more: WordPress SEO: the definitive guide »