When we refer to slugs, we’re not referring to those slimy creatures that come sliding into your vegetable garden and feast on your prized lettuce. Rather, we’re referring to slugs in the context of website URLs.
A slug is a segment of a URL that identifies a specific page on a website in an easily understandable and readable format, which also explains the webpage’s content. The easiest way to demonstrate this is by way of example.
Here is the URL of this blog: https://www.elemental.co.za/our-work
Which would make the slug: ‘our-work’
Simple right?! Well, yes, but it gets more complicated than that.
How do they actually work?
Firstly, a slug is a unique identifier for the resource. In other words, each slug needs to be unique, and no two pages can have the same slug, as this will cause conflict.
When a user browses a website and lands on a certain URL, for example: https://www.elemental.co.za/our-work
The website basically strips out the slug, which is “our-work” and then uses this slug to send it to the server to look up the correct resource from the website’s source code and database. It then returns everything (typically in JSON format) the website needs to be able to display load the relevant page or resource.
The History of URL Structures and the Rise of Slugs
Back in the early days of the Internet, when terms like “surfing the net” were cool, and before the invention of devices like smartphones, Believe it or not, things were quite different in the land of URL structures (I know who would’ve thought!).
When people used to use web browsers like Netscape Navigator and Internet Explorer (yuck!), there were no slugs in URLs. Almost all URLs were ugly and not user-friendly at all. The use of “GET parameters”, also known as query strings, was the flavour of the day. If you don’t know what GET parameters are, don’t worry, as luckily they’ve been almost entirely eliminated.
Essentially, GET parameters are a bunch of variables that are embedded in a URL’s structure to request certain data and resources to load that page.
For example:
Old school method using GET parameters
https://www.elemental.co.za/our-work/?projectID=8afdj28ak
Vs
Modern URLs using slugs:
https://www.elemental.co.za/our-work/heineken-mobile-web-app-development
Using slugs makes the URL much sleeker and easier to read and understand. It also describes what the page is about, which is a huge improvement compared to old school GET parameters. There are other benefits from an SEO point of view, but we’ll discuss more on that later.
So we’ve mostly transitioned away from these very encrypted-looking URLs to more wordy slugs, but why should you care, you may ask? Good question! We’ll reveal this below.
The complex structure of Urls and Slugs
Here is a look at a more complex URL structure. Note the folder in the URL, making the URL longer. As always, the slug is the last part of the URL, no matter how many folders there are.
The Benefits of Using Slugs in Your Website
Well, there are a number of reasons why we should be using slugs in our websites, web applications, eCommerce websites and BLOGs.
- It makes the entire URL more intuitive, as the slug describes what a particular page is about through the use of clever keywords.
- When sharing URLs that contain slugs, it can provide users with a description purely by viewing the slug in the URL. This is especially helpful when sharing URLs in newsletters, on other websites, BLOGs and on social media platforms. Users are more likely to click on these links if they have a short and descriptive slug.
- A massive advantage of using slugs and using the correct keywords in the slug to define what a page is about is pivotal to your SEO (Search Engine Optimisation) efforts.
How are slugs Generated or Created?
There are so many different programming languages, frameworks and content management systems (CMSs) that are available to develop websites, so we’ll only be covering two of these.
WordPress:
This is the most popular CMS, used by millions of websites around the world. When creating a post, you can edit the slug, which is linked to the URL, like this:
Note that this will only work with the right permalink settings enabled.
PHP MVC and Angular JS frameworks: The slug is generated automatically from the name/ title/ heading, depending on the context. On the edit page, we were able to update it to the correct slug.
Slugs benefit SEO, right?
Indeed, they do and the great benefit is that they are able too quickly boost your SEO score with very minimal work required.
Add a keyword to your slug
A keyword is a specific word that you really want to rank on search engines. By adding your keyword to the slug, you’re telling search engines like Google or Bing what the page is about. Google uses the words in a slug as one of it’s indicators to establish the keywords of the page and rank the website accordingly.
Craft user-friendly slugs
We’ve already touched on this, but making user-friendly URLs by using slugs is one way to get people to click on your link. This is really appropriate when it comes to search engines and the search results listings. The URL of the websites featured in these results is the one thing that people can see. So having appropriately structured slugs will go a long way in getting more users to click on your listing and ultimately more traffic to your website.
Imagine a search engine results page (SERP): users will see many different URLs about a certain search term, right? So you need to make sure your slug is in line with what people expect to see and specific to what they’ve searched for.
For example, a user searches for polarised sunglasses, and a bunch of search results are shown to the user.
If a URL was structured with a slug such as https://www.website.com/buy-polarized-sunglasses
vs
https://www.website.com/p=98sajcj3
It’s obvious that the user will be much more enticed to click on the result with an appropriately descriptive slug, right? These are quick wins that you can achieve and can have a dramatic effect on your SEO.
What makes an effective URL?
The key ingredients for an effective URL are to stay under a 100 character limit (including the slug).
For example: with long slugs such as, elemental.co.za/development/How-to-develop-a-brand-new-website, the most important ranking factors would be “development, website, how to” meaning you can leave out “brand new” within the slug and achieve the same results in terms of having a “well-optimised URL”.
Potential issues with Slugs
The good news, folks, is that there aren’t many downsides to using slugs on your website.
However, even though a slug may be concisely created, containing all the correct words, that slug may in fact not exist and therefore direct the user to a 404 page.
A big “no-no” in the world of slugs would be to overpopulate a slug with keywords. Rather stick to a single folder view and keyword title than multiple /folder/folder/keyword/keyword extensions. You get the point here, right?
An example of a bad URL structure in this case would be:
elemental.co.za/web-development/php-development/how-to-develop-a-brand-new-website-in-php
What are the Do’s, Don’ts and Limitations?
- Make sure the slug is short yet descriptive.
- Always, always use lower-case.
- A slug should not have accents, be ambiguous or have hard to read-at-a-glance characters.
- Don’t ever use punctuation marks; keep it fresh and professional.
Fun facts about Slugs
Sitemap generators:
Many websites and content management systems (CMSs) use sitemap generators to automatically generate all the links of a website on a single page (sitemap). Having really concise yet descriptive slugs help users and search engines navigate through the loads of links generated on this page.
Name origin:
The name is based on the use of the word slug in the news media to indicate a short name given to an article for internal use.
According to ABC News Radio, the word ‘slug’ possibly derives from a Scandinavian word meaning ‘to move slowly’ or (by extension) ‘to be lazy’.
Slugs are definitely slower for a server to process than article IDs, that’s for sure!
Bonus fact:
Did you know slugs (the real slimy kind, not the website variation) are basically snails without a shell? Huh! Who would’ve known? Well, now you know and can brag to your mates 😉
A quick wrap up
Slugs have so many great benefits and almost no downside that using them on your website is a complete must. However, creating them correctly to be user-friendly, incorporating keywords and sticking to the restrictions of what you can do with slugs need to be taken into consideration. By doing so, you’re ensuring your slugs can give you the optimal outcome, which leads to more clicks on your links, a boost to your SEO and ultimately more traffic, sales and inquiries.