The general public know slugs as slimy members of the animal kingdom.

We, web developers, however, know it as essentially the part of a URL or link that comes after the domain extension and helps identifies the webpage you’re viewing.

For example, the slug of this page is: avoid-losing-traffic-optimize-slugs


I’ve not the faintest idea how garden slugs inspired its naming, if you do happen to know – answers on a postcard, please!

But wait! Are slugs not the same as the page title?

Not necessarily, for several reasons.

Both post headlines and slugs require different sorts of optimizations. As we will later see, the post title may be quite a bit longer than what's ideal for the slug.

In addition, your page's title might change over the years but you will want to avoid modifying the URL. Modifying the URL breaks the links of wherever is linking to that post.

Therefore, you'll want to keep the URL a bit more 'neutral', accounting for any changes that might happen in the future to the post. For example, avoiding the year in the slug if you intend to update the post every year

Why bother optimizing them?

Optimizing slugs has benefits for both your Search Engine Results Pages (SERPs) and consumers.

If I've learned anything since blogging is that end-users, the humans consuming your content, do want to keep certain things short, simple, and crystal clear. In the case of URLs, they want to know exactly what they're clicking on.

We we'll see, a big part of optimizing slugs is making them neater and more compelling.

This has the following benefits:

  • Users will remember the URL easier if they need to return to the page later.
  • Users are less likely to click on a confusing and lengthy URL.

Consequently, optimizing your slugs with the steps below can prevent losing out on some traffic. Especially if your article is being linked from somewhere else on the web.

As covered below, there is also evidence that it improves your rankings on the Search Engine Results Pages (SERPs).

How to optimize your slugs

1. Relate them to your page

Search engines do not only take your posts or web pages into account; they also analyze your URLs and other metadata to decide whether or not to rank your page against a particular search query.

Therefore, slugs should ideally accurately describe the contents of the link.

2. Should contain the keywords or keyphrase you want the post to rank

Keywords are what people type into search engines like Google.

Ensure you have those keywords in the slug, (as well as the page headline) will help you to rank for the keywords.

3. Should be short

The slug should be short, around 3-5 words.

Most people achieve the shortening by removing stop words. Stopwords are the words that do not add much meaning to a sentence and be safely ignored without sacrificing the meaning.

Links that are too long may discourage people from clicking through, as they can appear untrustworthy.

On the other hand, URLs that are too short and simplified almost look lazy and don't read as fluently. Humans are much better at consuming and interpreting natural language and are also enticed to click by emotive words such as “best” or “fantastic”.

However, if you are targeting a longtail keyword, it may make sense for your URL to reflect the additional length. You will need a few additional words to clearly describe what your content is all about, which may give you more relevance and ranking potential in the SERPS for your longtail keyword.

As an example, taking the post title: “The Best Dumplings in Tokyo for Those Who are Hungry and on a Budget.”

Could be slugified as

Comes in at 7 words, is concise and readable, (despite being half the length of the post title). We've also kept the words, 'best', 'hungry' and 'budget'.

So, when shortening, finding the right balance between appeal and length is important.

What are long-tail keywords? You can increase your chance of success at ranking for a post or page in the SERPs by targeting long-tail keywords. Long-tail keywords consist of more words that are more specific and precise than key words, ‘best dumplings in tokjo hungry and on budget’ is an example of this. Long-tail keywords are less searched for than very popular ‘head’ keywords, but that also means less competition and increased opportunities to convert.

4. Don't put numbers or date in the slug unless it impacts on the content

This risk looking spammy and will put people off reading them.

Don't use the post ID as the post slug as it doesn't give the search engine anything to work with in understanding what your content is about.

The only instances where this could work is for a 'list of top products' or a post that relates to a specific product with a yearly edition.

A brief history on slugs

In the days before content management system like WordPress existed, each web page required its own HTML file.

For example, an about page would have require its own file called “about.html.”

The URL for the page would be the site's domain followed by a slash (/) and then the HTML file’s name:

The site’s domain ( followed by a slash (/) and then the HTML file’s name (e.g. HTML files like this are no longer used by services like WordPress, but the browser still has to know which page to view and the slug provides the identifier.