How to Write URL Slugs for Your Website

So, you started a blog with quality content, implemented some keywords, set up your socials, improved your website speed and added some schema. You’ve taken care of your ecommerce SEO, right?

Not quite.

There’s one thing that is easy to miss, especially if your ecommerce store is set up through a website builder like WooCommerce or Shopify:

Your URL slugs.

No ecommerce SEO strategy is complete without ‘em.

What Is a URL Slug?

A slug is a part of a URL (Uniform Resource Locator). A URL is a web address, and the slug is the part at the end that identifies the exact web page the URL points to. For example, “product-name” is the slug in www.ecommerce.com/category/product-name/.

Like many page builders, a slug in WordPress defaults to the name of the web page. While choosing a URL slug based on the page’s name can be effective, it should be a thoughtful choice.

Using a default page slug without a strategy can damage your SEO and user-friendliness.

Why URL Slugs Are Important

Search engines, like Google, use many factors to understand a page’s content and determine its ranking for search queries. The slug of a page URL is one of these factors, so it must make sense to search engines and describe the page content accurately.

Slugs also describe page content for users and play a role in URL clickability.

In search engine results pages (SERPs), the URL appears around your page’s title. With Google, your URL directs the breadcrumbs as pictured below. Where the URL is https://birthdate.co/pages/the-birthdate-candle, the breadcrumbs appear as “domain > pages > the-birthdate-candle.”

Example of breadcrumbs in a URL slug

As a result, your page URL, including your slug, can play into a user’s choice to click on your link. This is also the case when someone sends you a link as long, irrelevant links are suspicious or questionable.

This all goes to say that slugs are important to search engines and users, and thus, your success.

How to Write a Great Slug

1. Follow Slug Character Best Practices

Slugs have their own grammar, and though the rules are more like suggestions, it’s worth following best practices.

Don’t Capitalize Letters
While slugs can use capitalized letters, keeping them all lowercase looks better and breeds consistency. It also prevents typos and broken links when case sensitivity is prevalent.

Avoid Special Characters
Avoid using special characters – other than dashes to indicate spaces – in a URL slug. Special characters make slugs appear less professional and are harder to read.

Many characters also have special meaning within URLs and may look different or cause problems. For example, spaces in a slug will render as “%20”.

Use Hyphens for Spaces
Due to the circumstances with special characters, you can use dashes or underscores in slugs to show spaces between words.

Of the two, we recommend using hyphens instead of underscores. They are easier to interpret, and Google makes the same recommendation.

Add a Trailing Slash
A trailing slash is the “/” at the end of a URL slug, and it is entirely optional.

Many advocate for using the slash because it looks better and indicates that the URL is complete – the same way .pdf does for a PDF URL.

The World Wide Web Consortium (W3C), a group responsible for advising on web standards, recommends using the trailing slash to indicate a container URI.

2. Make Slugs Relevant to Page Content

Slugs should accurately represent the content on a page.

Keeping slugs relevant helps ensure that search engines will rank your content for appropriate search queries. It doesn’t help to rank #1 for a query when those searching for it aren’t interested in what your page offers.

A common tactic is to match your slug to your H1 header. For a product or category page, that’s usually the title of the product or category; for blog content, it’s the title of the blog post.

Should Slugs Match the Page Title?

Relevancy could be why page builders often default slugs to the title of a page, but it’s a practice to be wary of. Copying the title may result in slugs that are longer than necessary or that add limiting context should you ever update page content.

The goal is to write a slug that provides readers with an accurate idea of what they are clicking on, but there are ways to optimize it further.

3. Keep URL Slugs Short

User- and SEO-friendly slugs are short, averaging 3 to 5 words in length. Short slugs are easier to remember if users need to find them again and easier to share on social platforms with character limits. Users are also less likely to break short links.

In regards to ecommerce search engine optimization, the biggest culprit of long URLs is parameters.

Parameters lengthen URLs and cause Google to interpret pages as duplicate content, hurting SEO. In general, parameters also make URLs look less professional and click-worthy by adding a string of seemingly meaningless characters at the end.

For ecommerce websites, however, parameters can be necessary, especially when you sell a lot of products. Parameters help ecommerce businesses monitor campaign performance and allow for additive filtering and sorting of products for customers.

If you require parameters, Google’s URL Parameters tool can help manage your SEO.

Note: Google recommends only using the tool if your website has over 1,000 pages, multiple of your pages are tagged as duplicates and you’re an SEO specialist. Otherwise, you may end up doing more harm than good to your ecommerce SEO.

4. Remove Function Words

In linguistics, a function word is “a word whose purpose is more to signal grammatical relationship than the lexical meaning of a sentence.” Examples of function words include a, the, and, is, on, do and of.

In regards to search engines or NLP, these words are sometimes referred to as stop words.

You can remove function words from slugs to make them shorter because they don’t contribute as much to a search engine’s understanding of your content.

Sometimes keeping function words is a good idea for real people, but we’ll get into this under Prioritize Reader-Friendliness.

5. Remove Unnecessary Words

It can be a good idea to remove other unnecessary words from slugs, but it’s up to you to determine what is unneeded. Words like “your,” “like” or “guide” may be unessential in some instances but add value in others.

Decide for each word the value it holds for readers and search engines and whether that value trumps simplicity.

6. Prioritize Reader-Friendliness

Reader-friendly slugs help you take advantage of the user benefits of good slug writing.

A reader-friendly slug will represent page content and make sense to readers. These are not always one and the same.

For instance, removing function words may shorten a URL but remove so much context that the reader no longer understands the slug. The slug how-to-design-a-website becomes confusing when made how-design-website.

A keyword may be relevant but grammatically incorrect. While grammar isn’t a priority, confusing grammar can get in the way of reader understanding.

A product ID or SKU number may identify the exact product that a page is for, but it doesn’t mean anything to the user.

When choosing between a more reader-friendly option and a keyword or shorter URL, always prioritize the reader.

7. Use Keywords in Your Slugs

Many sources emphasize optimizing slugs with keywords. While this is a tactic to take advantage of, it shouldn’t be the be-all and end-all.

Both John Mueller and Matt Cutts of Google suggest that keywords in URLs help a little but aren’t critical to ranking.

However, if you want to go the extra mile with your ecommerce SEO and use keyword-based slugs, there are some guidelines to follow.

  • Don’t keyword stuff: Keyword stuffing only hurts SEO and readability.
  • Choose a head keyword: You can use your other keywords throughout your content.
  • Aim for long-tail keywords: These are more likely to match search queries.
  • Keep keywords relevant: Don’t focus on keyword volume at the expense of accuracy.

When it comes to SEO for ecommerce sites, the keyword for a product or category page is often the name of the product or category. This makes it easy for users to understand the URL and navigate the site.

Before you choose a keyword for your URL slug, check the search intent behind the keyword. If the pages that rank for it are primarily blogs and yours is a product page, it’s probably not the best choice.

8. Keep Slugs Evergreen

Evergreen content is content that doesn’t go out of date and stays relevant to readers. An evergreen slug follows the same notion. To keep slugs evergreen, use caution when adding dates or numbers, and shorten the slug as needed.

Using dates can make your content feel outdated in the future, and numbers may not hold up over time. Including a date or year may be acceptable for one-time event landing pages.

Longer slugs that provide too much descriptive context may lose relevance if you ever add to or update the page. Some advise sticking to a general target keyword for this reason, but it’s ultimately up to you. It depends on your content and practices regarding updates.

Updating your content is a critical component of keeping your website fresh for SEO and credibility purposes. If you update blogs and product pages often, then the dates, numbers, or extent of information you provide (a how-to versus a complete guide) may change, and you will have to update the slug.

Always consider the likelihood of you wanting to change the slug in the future before committing to it.

Is It Bad to Change a URL Slug?

Yes, and you should avoid it if possible. Changing a URL post-launch is a difficult process and damages your SEO. The page loses earned links and visibility in search engines, negatively impacting traffic. Using evergreen slugs can prevent the need for updates and protect slug SEO.

If you do change a URL, you have to track down and update any links to the old URL, including internal and external links. You can also create a 301 redirect.

If you do neither, anyone who clicks on the old link will get redirected to a 404 error instead of your content.

It’s much easier to change a page title than a URL, so allow your title to provide more context while keeping URLs simple.

9. Consider Your Website Architecture

A defining feature of slugs is that you can only use them once. The one exception is if another part of the URL path, like a category, is different.

Thus, it’s best to consider a page’s context within your website architecture to make sure the right slug is being used in the right place. You don’t want to use a slug for a blog and discover later that it would be the perfect slug for one of your products or product categories. We’ve already discussed why changing a slug after the fact is painful.

Be sure to consider your content marketing strategy, product lists and landing pages when selecting your slug. If it’s for a product, consider that product’s place among other products. If it’s for a blog, be sure to consider whether the blog is cornerstone content or part of a series.

If you haven’t determined a strategy for your website’s architecture, mapping your ecommerce user flows can help.

Create your URL Strategy

SEO for ecommerce sites requires a multipronged strategy, and optimizing your URL slugs is one of those prongs.

But the fact remains that the slug isn’t the only part of your URL that matters. While special emphasis may be given to the slug because each page requires its own, every element of the URL path helps search engines and users understand page content and site navigation.

Consistency and logic should define how you structure URLs for different pages of your ecommerce website, and you should have an overarching strategy to defer to for that consistency and logic.

You read the whole thing!

Here’s what to do next:

1

Give us your email. We will treat it like gold and add some culture to your inbox.

2

Share this article on your favorite social network, especially Twitter or Linkedin.

3

Follow us

4

Share us in your favorite slack channel.