What Is a Slug and How Does It Affect Your URL?

Jonathan Bossenger / August 9, 2018

, , ,

Of all the odd lingo that you hear when learning about website building, “slug” is definitely one of the stranger ones.

What is a slug? In this context, it’s not an animal — it’s the piece of a URL that identifies the specific website page you’re on.

Whenever you see the name of a post, page, category, or tag tacked on to the end of a website address, that’s the slug. It helps create a specific URL, also known as a “permalink,” that people use to access the exact page on your website they want to visit.

While WordPress.com slugs are used for posts, pages, categories, or tags, most people only worry about how they affect pages and posts. This article will focus on how the slugs for your posts and pages are generated and why they matter.

A quick history of slugs

In the days before website building services like WordPress.com existed, web developers needed to create pages of code written in a coding language called HTML. Each page of your website would need its own HTML file.

So, if you wanted an About Me page on your site, you needed a separate file for it called: “about.html.” Once that page was published, its URL would read as the site’s domain (www.example.com) followed by a slash (/) and then the HTML file’s name (e.g. http://www.example.com/about.html).

Services like WordPress.com don’t use HTML files like this, but the browser still needs to know which page to display. Today, the name of an HTML file is replaced by the slug. If you create a page with the slug “about,” the URL for that page will be http://www.example.com/about.

How a slug is generated

By default, WordPress.com uses the title of a page or post to generate its slug. WordPress.com also makes sure that a slug is browser- and search-engine-friendly.

For example, if your title is a single word (e.g. “About”), the slug will be the same word, but in lowercase (“about”).

Where the slug appears on WordPress.com

If you have a longer title, WordPress.com adds hyphens to the slug, as spaces are not browser friendly. So, the slug for a page titled “My New Page” will become “my-new-page.” Any other non-browser-friendly characters (like currency or special symbols) will either be replaced or removed.

Slugs and permalinks

WordPress.com tacks the slug onto the end of your website address to generate the final permalink for that page or post.

For pages, the permalink will be your domain name followed by the page slug (e.g. https://wordpress.com/about/). The permalinks for posts, however, also include the date of the post (e.g. https://discover.wordpress.com/2018/04/19/website-building-tips/).

This means that you can have a post that uses the same title (and therefore the same slug) as a page, but the permalink for each will be unique.

Customizing your slugs

For both posts and pages, you can edit the slug by selecting More Options from the menu to the right of your editor.

More options for changing your slug

For pages, the slug will also appear in an auto-generated permalink just below the title (see the image under “How a slug is generated”). By selecting the slug portion of the permalink, you can enter your own custom slug for that page.

Creating custom slugs is a great idea if your post or page title is especially long, or if its permalink would be difficult to remember. Having a good slug can also help you rank higher in search engine results, as Moz explains.

Now that you’ve answered the question, “What is a slug?”, make sure that your own slugs are all serving your site well.

Create your new blog or website for free

Get Started