When search engines crawl a page on your site, they look everywhere for clues to what your content is about: the title, headers, body, image alt text, meta description, even the URL.
In fact, URLs are one of the first elements search engines crawl. They also contribute to the first impression of your readers as well. URLs that are too long or contain strings of random numbers and letters instead appear less clickable and less trustworthy than URLs that convey information about the content of the page.
For these reasons, optimizing your URLs is an essential step in improving your on-page SEO.
In this post, we’ll define what a slug is and explore some best practices for optimizing them. Then we’ll take a look at the different ways you change them in WordPress.
What is a slug in WordPress?
In WordPress, the slug is the editable part of the URL of a page. Located at the very end of a URL, the slug most often contains keywords separated by hyphens. It may also contain the day, month, time, random numbers, the author name, and more, depending on the site’s permalinks structure.
To ensure we understand what a slug really is, let’s take a brief look at the different parts of a URL. Starting from left to right, we’ll break down this post’s URL, pictured below.
First, there’s the scheme, where you’ll most often see https:// (or http:// is the site isn’t secure). Then there’s the subdomain, like “blog” in this URL or simply “www” in others. Next there’s the second-level domain — the name of the website — and the top-level domain, which is most often .com.
After the first slash is the subdirectory, which indicates what subsection of the website we’re on. In this post, the subdirectory is “website” because we’re on the website section of the HubSpot blog.
After the second slash is the slug. Before we walk through how you can change the slugs on your WordPress site, let’s go over some best practices for optimizing them. That way, you’ll know exactly what you’re doing when you log into your dashboard to change them.
How to Optimize a URL’s Slug in WordPress
Designing for humans and bots should be a guiding principle for everything you do as a site owner. That includes optimizing a URL’s slug in WordPress. To optimize them for search engine bots as well as your readers, follow the best practices below.
Include 1-2 Keywords
Make sure to include the keyword phrase you want to rank for in your slug. Both search engines and readers will look here to determine what the page or post is about. The general syntax should look like: websitename.com/topic-mentioned-here.
Match the Title (But Don’t Replicate It)
You want a URL’s slug to closely match the title of the post or page. If one is about dachshund puppies and the other is about WordPress SEO, for example, bots and readers are going to be confused.
However, optimizing slugs isn’t as simple as copying and pasting the title of the post or page. Since the ideal length of titles is 60 characters or less, titles are much longer than slugs should be. They also use spaces and Title Case, whereas slugs should use hyphens or underscores and lowercase.
Remove Any Unnecessary Words
You can make slugs more readable by omitting pronouns and prepositions like “a,” “the,” and “to.” These are known as stop words and are generally ignored by search engines anyways. A general rule of thumb is if readers and search engines can fill in the gaps and make sense of the slug without certain words, omit them.
Now that we’ve covered these tips and techniques, let’s look at them in action. Here’s some examples comparing the title vs. the slug of HubSpot blogs:
Keeping these best practices in mind, let’s now walk through the process for changing a URL’s slug in WordPress.
How to Change a URL's Slug in WordPress
By default, WordPress uses the “plain” permalink structure, as shown below.
Because it contains the account name and some random characters and numbers rather than keywords, this is not an SEO- friendly structure.
Changing this default permalink structure is an important step in making your WordPress blog SEO-friendly. You can do so by navigating to Settings > Permalinks and selecting another option. We recommend “Post name” because it is the shortest and includes relevant keywords.
Please note that it’s important to change your permalink settings during the set-up process. If you change them after your site goes live, then you’ll have to set up redirects to ensure there are no broken links on your site. Fortunately, there are plenty of redirect WordPress plugins to help simplify this process if you need them.
Once you see the notification that your permalink structure has been updated successfully, you can now edit the slug of individual posts and pages on your site. Let’s walk through the process step by step.
1. Navigate to Posts > All Posts to edit an existing draft or Add New to create a new draft. You can follow these steps for Pages as well.
2. If you navigated to All Posts, then scroll to the draft you want and click Edit.
3. On the right-hand side of the screen, click the optional control next to Permalinks to open the dropdown menu.
4. Edit the slug. In this case, I’ll change the original slug from “how-to-change-a-url's-slug-in-wordpress” to “how-to-change-slug-wordpress.”
5. Click Save Draft in the toolbar at the top of the screen.
You can repeat this process for all your posts and pages moving forward. This will ensure you’re creating SEO-friendly URLs that delight search engine bots and your site visitors.
Originally published Jun 17, 2020 7:00:00 AM, updated June 17 2020