Overview of URL Slugs
A URL slug is the unique section of a web page's URL following its domain name. Every page on a website has a different URL slug, which is displayed with the site's universal domain name in visitors' web browsers. Take Facebook Marketplace, for example. The social media network's local classified ads page is available at Facebook.com/marketplace. The URL slug for that page is "marketplace," whereas the site-wide domain name is Facebook.com.
Your website's homepage won't have a URL slug. Rather, the complete URL of your homepage will consist solely of the domain name. For every page you create, however, a URL slug will be affixed to the end of the domain name. It's essentially an identifiable marker that helps search engines and visitors locate specific pages on your website.
Some web pages have a longer URL slug consisting of multiple words, typically separated by a hyphen. And if the file for a web page is stored in one or more folders below the site's root directory, the names of the folder or folders will be included in the page's URL slug as well. A web page with the URL slug "sports/baseball/how-to-choose-a-baseball-bat," for instance, means the web page file is stored in the "baseball" folder on the site's server, and that folder is stored in the "sports" folder in the root directory. If the web page file was simply stored in the root directory, it would have the URL slug "how-to-choose-a-baseball-bat."
How URL Slugs Affect SEO
URL slugs can affect your search engine optimization (SEO) efforts, directly and indirectly, in several ways. When Google crawls your site's pages, it will analyze your pages' content to determine what they are about. Along with using artificial intelligence (AI) algorithms to read text and decipher images, it will look at the URL slugs. Using the previous example, Google may assume that a web page with the URL slug "how-to-choose-a-baseball-bat" offers advice on how to choose a baseball bat. If the text and other on-page content reinforce this belief, Google may increase the page's ranking for the search query "how to choose a baseball bat." Using a generic URL slug like "page-12" won't necessarily hurt your SEO efforts, but it's not beneficial either.
Using concise, SEO-friendly URL slugs will also improve the appearance of your website's listings in the search results. A typical web page listing contains the page's title, description and part or all of its URL. If you keep your URL slugs short and relevant to the page's content, more users will click your listings in the search results.
How to Customize Your Website's URL Slugs
URL slugs typically reflect the file name of the respective web page. When you create an HTML file for a web page, whatever you name the file will be displayed as the URL slug -- at least that's how it works for static web pages. The problem is that most websites today are built using a content management system (CMS), including WordPress, that automatically create dynamic web pages. Therefore, the pages don't have a static file that you can rename. But even if your website uses a CMS, there are still ways to customize your URL slugs.
In WordPress, you can customize URL slugs in the admin dashboard. Click "Settings" and choose "Permalinks" from the expanded options, at which point you can select your preferred URL slug structure. WordPress calls them "permalinks," but they are essentially URL slugs. Selecting "Post name" for your website's URL permalinks will create URL slugs based on the title of your posts and pages, with hyphens separating words in multi-word titles. If you select "Day and Name," WordPress will include the date on which the post or page was published as well.
Alternatively, you can create custom URL slugs for each post or page in WordPress manually. If you're using the Gutenberg editor, which is the new default editor related with WordPress 5.0, clicking the title of the post or page will reveal a "permalink" field at the top that you can click to set the URL slug.
Tips on Creating SEO-Friendly URL Slugs
Whether you use a CMS like WordPress or build static web pages using software like Adobe Dreamweaver, there are a few tips you should follow to create SEO-friendly URL slugs. For starters, avoid using generic, nondescript URL slugs consisting of random letters and numbers. Instead, create URL slugs that reflect what the web page is about.
It's also recommended that you use all lowercase letters in your URL slugs. You can typically set your website's URL slugs to include both lowercase and uppercase letters, and in most cases they'll function fine. In other cases, including uppercase letters in a URL slug will direct users to a 404 error page when attempting to visit the page by typing all-lowercase letters into their web browser's address bar.
Finally, use hyphens rather than underscores to separate words in your URL slugs. If your website runs WordPress, it will automatically use hyphens. For other platforms and static web pages, though, you'll have the option of using underscores or hyphens. Of those two options, Google recommends using hyphens. Words in a URL slug separated by hyphens look cleaner and more legible than those separated by underscores, so users are more likely to remember them.
Using the right URL slugs will help your website rank higher in the search results. However, it's just one of many factors that can influence your SEO success. To dominate your competitors on Google and Bing, perform a full analysis of your site's on-page and off-page ranking signals. This will allow you to identify problematic areas in need of improvement.