What‘s the difference between slugs and URLs?
This is a slug:
what-is-a-value-javascript
A slug is just a part of a URL
This is a URL:
https://techstacker.com/what-is-a-value-javascript
This URL is constructed by:
- a protocol:
https://
- a domain:
techstacker.com
- a slug/path:
what-is-a-value-javascript
The URL refers to the entire thing.
The slug is the part of a URL that explains what the page (path) you’re going to is about in human-friendly keywords. I wrote slug/path above because both terms are used. Slug is especially used in the SEO scene.
To reinforce and sum it up:
- a slug is a descriptive path in a URL
- a URL refers to the entire thing (protocol, domain, slug/path)
Your slug is an important part of SEO (Search Engine Optimization) so it’s worth learning how to create user-friendly slugs on your website.