Waning icon

Fully booked: MarkIT Space is currently booked out until 3rd June 2024. Interested in working with us? Join our waiting list.

MarkIT Space

How to Write an Effective SEO-friendly Web Page Slug

A beautiful bright purple and yellow sea slug

Written by Kellie Watson, Director ~ MarkIT Space

16th March 2023

Tag

SEO

If you are interested in learning about the nitty-gritty components of your website, which will help to improve its search engine ranking, then you mustn't forget about the slug. The internet world seems to have multiple tiny creepy crawlies, including spiders, their webs, bugs and even slugs too! Now, when it comes to your website, you shouldn't be afraid of the slug that slides into every page of your website, and this article will ease any fear. It was written to help you understand what a website slug is and to provide an ultimate guide for every website owner who wants to ensure each component of their website is created with the best chance of SEO success in order to rank highly for potential customers to find.

Learn to create friendly web page slugs as beautiful as this little guy!

I've been developing web pages since the last millennium (shock-horror)! That is, since 1999, so only 24 years ago (not 1,000)! During that time, I have experimented with different recommended ways of slug-naming and have identified what I believe is the current best approach. This article shares my discoveries in detail, which takes into consideration the best practices for search engine optimisation (SEO), usability, accessibility, and machine and human-friendly naming conventions.

What Is a Web Page Slug?

Every single web page has a slug to some degree. It's not always visible, as it's not typically seen on your website's home page, but it can be seen on every other page of a website. Web pages such as 'services', 'about', 'contact us', and every product page and blog post can have a slug.

A web page slug is the end part of a web address (URL) that identifies a page within a website in an easy-to-read format that is often used to describe the content of the web page. For instance, the entire web address that points to this specific web page on the internet is:

https://markitspace.com.au/blog/web-page-slug

The slug is the end part of the web address after the last forward slash, "web-page-slug".

What Is a Clean URL?

A web page slug is also known as a 'clean URL'. Understanding what is meant by a 'clean URL' helps to understand what is meant by a slug. For instance, web pages are files written in a coding language called HTML. Therefore, to save an HTML web page called 'Services', its file name would be services.html. Like all the files saved to your computer, they have an identifiable name, a full stop, and approximately three letters that help to describe the file type, so the computer knows which application is best for reading that specific file. A clean URL rewrites the file name to display a more intuitive meaning URL to users in their internet address bar by not revealing the full stop or file type characters of the web page's file name. So the slug or clean URL for services.html would simply be 'services'.

The History of the Slug and Why Web Page Names Are Referred to as a Slug

When I first heard the term 'slug' in relation to the web, I thought it must stand for something, as I knew in real estate that a SLUG refers to a single lock-up garage. But it turns out it isn't an abbreviation for anything, and its meaning is actually closer to the slow, slimy creature. Slug comes from the word 'slugge', which dates back to the early 15th century and was used to refer to a slow and lazy person. The newspaper publishing industry used 'slug' as their 'lazy' title. When articles that were in production made their way through the editorial process, it was easiest for all the people involved, including journalists and editors, to refer to the article amongst each other with a shorter, meaningful name.

The Associated Press Stylebook (commonly called the AP Stylebook) has been journalists' bible for American English Grammar usage in reported public-facing corporate communications for the last 70 years. It stipulates that the slug 'clearly indicates the content of the story'.

From the newspaper publishing era to the digital age of online publishing on the World Wide Web, the slug has slid its way into a new meaning. Now you know why it's called a slug and where it originated. Next, I'll explain the best practices for naming a web page slug and how it can help your search engine ranking.

Boost Your Search Engine Ranking With Your Slug

Search Engine Optimisation is quite the mouthful, and therefore it is most often referred to by its abbreviated form, SEO. Optimising your website helps search engines like Google and Bing find your content easily and rank it high in organic search results, above your competitors, where more people can discover it.

Wouldn't you love to drive more organic traffic to your website from search engine results? An SEO-friendly web page slug is one of many crucial elements that can help your website rank better on search engine result pages (SERPs). Every single element of a website should be designed and developed with search engine optimisation in mind. Well, at least we do here at MarkIT Space for every website we develop. Why have a website at all if you don't want it found by your ideal customers?

Since an SEO-friendly slug essentially describes the content on a particular web page, it should therefore contain relevant keywords that accurately describe the content on the page. This makes it easier for search engine crawlers to understand what your page is about. For example, if you're creating a page about tips for running long distances, then words such as "running", "long-distance", and "training" could all be included in your website slug. Additionally, including location-specific terms like "Brisbane Marathon Festival" can help with local search engine optimisation.

Crafting SEO-friendly web page slugs is essential to running a successful website and requires careful consideration and keyword research. Researching relevant keywords related to your topic and relevant to your business can help you create an effective slug that accurately reflects what you want your page to be about. You should also consider your audience and ask yourself who you are trying to reach. Think about what kind of information would be helpful for them and how you can incorporate those keywords into a short descriptive phrase without sacrificing readability or accuracy.

Using targeted keywords in a slug can potentially drive more organic traffic to your website. Search engines will recognise those keywords and show your page when someone searches for them, increasing the chances of people clicking through to your site and staying on it for longer periods of time than if they were randomly searching for something unrelated.

SEO is not only about satisfying search engines. It's ultimately about creating content that is easy for users to find exactly what they are looking for when searching for something online. By following all the guidelines in this article when creating slugs for your web pages, you can increase the chances of your pages being found by search engines, resulting in more people discovering your content through organic search results and enjoying an improved user experience.

Creating an SEO-friendly web page slug can help boost traffic, improve SERP rankings, and make it easier for people to understand what a page is about at first glance. With these benefits in mind, learning how to create an SEO-friendly website slug is essential for any webmaster who wants their site to be successful online.

Best Practice Guidelines for Creating Slug Names

URLs should be user-friendly, easy to remember, and intuitively meaningful to users. They are a virtual address to your business, like your street address, for people to easily find. Since the slug name is part of a URL name, similar rules and guidelines apply, which are detailed in the sections below.

Slugs Should Be Short and Concise

Slugs are typically one or more words. They should be short and succinct, with no more than four words, so they don't take up too much room in the URL bar. Although they should be concise and easy to read, they need to be accurate and informative, so search engine crawlers can easily identify what the web page is about, and people searching for a particular topic can understand what your page is about quickly. If potential visitors have a clear idea of what they might find based on the page's web address, it can draw people in and are more likely to click through to your page.

Avoid Special Characters and Spaces

Although URLs should look easy to read for us humans, they also need to be easy for computers on the internet to understand which website address it needs to fetch. The language that computers understand was written in the 1960s and is still used today!

This means when creating a web page slug, it is essential to avoid special characters, symbols and spaces. This includes symbols such as hashtags (#), plus signs (+), ampersands (&), dollar signs ($), apostrophes ('), and more. Special characters can cause problems with specific internet browsers and confuse search engines, potentially damaging your SEO optimisation or being omitted from search results altogether. So, if special characters are included in your page title, make sure you leave them out entirely in your slug.

Some special characters and symbols are reserved for providing certain instructions to the computer, which is one of the reasons they should be avoided. As such, it's best to stick with alphanumeric characters and hyphens (-) when writing slug names and all other files uploaded to your website.

As an example, when non-savvy tech people upload images and media to their websites, they often don't give much thought to file names, and they often contain a space. As spaces aren't allowed in a URL file path, the web address needed to access that file must replace spaces with '%20', the computer-friendly code for a space. Having symbols and characters converted to their 'percent code' (which always contains two hexadecimal digits, which are numbers and/or the letters from a to f, and beginning with the percent sign) doesn't look user-friendly at all!

Handling Multi-word Slugs

The most common special character substitution needed in a slug is representing a space when it contains more than one word. I've read multiple style guides that each explain the best way to handle multiple words in a slug. Guess what? There isn't a uniform approach! Even amongst large well-known web contributors such as Mozilla's MDN Web Docs and Google, they provide different recommendations to best practice slug-naming.

Some style guides have suggested using an underscore to replace a space. However, I favour Google's style guide, which recommends using a hyphen (-) and not an underscore. There are multi reasons for this. For instance, web addresses are often underlined, which we know means a hyperlink. When underscores are used in a hyperlink, they are hard to see when underlined. Therefore it's more user-friendly for people to clearly see a hyphen. Also, underscores are read as one word by most search engines, while hyphens are seen as separate words. That means that search engines may not interpret your keywords correctly if you have used underscores to separate words.

Only Use Lowercase Letters

Along with using an underscore to replace a space, I disagree further with Mozilla's MDN Web Docs Style Guide, which specifies that sentence case should be followed when naming slugs. They provide an example for a 'Getting Started' page where they would name the slug 'Getting_started'. I follow the lowercase-only rule. So, I would name a 'Getting Started' page slug as 'getting-started'.

Along with using an underscore to replace a space, I disagree further with Mozilla's MDN Web Docs Style Guide, which specifies that sentence case should be followed when naming slugs. They provide an example for a 'Getting Started' page where they would name the slug 'Getting_started'. I follow the lowercase-only rule. So, I would name a 'Getting Started' page slug as 'getting-started'.

Using only lowercase letters in a URL is important for compatibility purposes. Some search engines, web browsers and servers treat URLs as case-sensitive, so mixed case URLs can cause issues. It's possible that you could have a web page that contains a capital letter in its name and have another, different web page with the same name but containing only lowercase letters. Wouldn't that be confusing! If that were the case, search engines would likely penalise your pages as duplicates, and those pages wouldn't rank highly in search engine results.

Mixed-case URLs are more likely to be manually mistyped by people. Some web servers will fail to load the page at all if it contains the incorrect letter case. So, it's best that you only use lowercase letters in URLs, slug names and other files you upload to the internet. Words that would normally be written in uppercase letters should be written in lowercase.

Each Slug in Your Website Should Be Unique

Giving each page of your website a unique slug name is important for various reasons. First, it helps to make sure that your URLs are easy to read and understand for both users and search engines. This can help with SEO, as search engine crawlers will be able to more easily identify and index your pages. Unique slugs can also help to prevent duplicate content issues. For example, if two pages have the same slug, search engines may consider them the same page, resulting in a penalty. Finally, it can help to make sure that users are directed to the correct page when they enter the URL in their browser.

WordPress Slugs

The WordPress Slug
The WordPress Slug

If you have a website built with WordPress, you are amongst those with the most popular website content management system (CMS) used throughout the world. WordPress automatically generates a slug when you create a new post, page, category, or tag with the title that you used to name it. The slug tends to be very similar to the title unless you manually rewrite the slug.

Perhaps, when you've created or edited a page or post in WordPress, you've noticed the field for 'slug' and wondered what the heck that means and what's it for. Well, now you know!

So, if you'd like to change it to something more suitable than what WordPress created automatically, simply change the field by following the best practice guidelines described in this article.

Custom-developed Website Slugs

If you have a custom-developed website coded from scratch (like this website), then, like the rest of the site, you are responsible for specifying the slug in your '.htaccess' file. So if you are comfortable updating the code, then go ahead! Or, if you have a developer who looks after your website, ask them to ensure you have 'clean URLs' throughout your website.

Now, I'll explain how I do it. It's so simple that I feel like I'm cheating! First of all, I actually save my files as the slug name I want to use. Then, in my '.htaccess' file, I have a rule that removes the file extension from the end of it. So, if your '.htaccess' file, check if the following line of code already exists:

RewriteEngine On

If not, then copy that code onto a new line. Otherwise, for the following code, make sure you add it on a new line that is below that code. The next line of code you need is:

RewriteCond %{REQUEST_FILENAME} !-f

Finally, the third line of code (I told you this was simple) depends on the type of file extension you have saved your web page files in. For instance, they could be saved as a '.html', '.htm', '.php' or a '.asp', just to name a few. So, if your web page files end in '.php', your code would be:

RewriteRule ^([^\.]+)$ $1.php [NC,L]

However, if your web page files end in '.html', replace the 'php' above with 'html'. For instance, you would write:

RewriteRule ^([^\.]+)$ $1.html [NC,L]

Conclusion

By following the guidelines outlined in this article on how to create an SEO-friendly web page slug, such as using hyphens to separate words, using lowercase letters, keeping slug names short, descriptive and unique, and avoiding special characters and spaces, you are on your way to developing better SEO practices for your website. Creating an SEO-friendly web page slug is one of the many elements you should pay attention to for improving your website's search engine ranking. Taking the time to tailor each slug to its corresponding page is one small step that will help you get more traffic and boost conversions, ultimately leading to greater success for your business.

Comments

This was so helpful thank you

Donna, 16th March 2023

Thanks for this. I understood... most of it lol

Keryn, 16th March 2023

If you found this ultimate guide to web page slugs interesting or helpful, give it a thumbs up.

Thanks for the 'like'!

Liked by 8 people

If you have any comments or questions, send us a message:

Post publicly