How big should a Slug be?

What is a reasonable field size for a “Slug” (e.g. www.MySite.com/articles/why-incorporating-your-business-makes-sense)

Right now, I have a VARCHAR(100) chosen.

Thoughts?

Thanks,

Debbie

VARCHAR(255) is exactly the same as VARCHAR(100) except that it will hold a larger value

for some columns, where you anticipate a chance of needing to store a value larger than 255 characters, you might want to choose TEXT instead (this is handled differently internally than a VARCHAR)

but slug isn’t one of them :wink:

Except that a VARCHAR(255) allows up to 255 characters… gasp And I don’t want slugs to be that long. (Would you?!)

I am thinking that if you can’t say it in 100 characters then you need to re-think things. But that is just me?!

Debbie

that sounds fine

make sure you add code to test the length of any proposed slug, and issue a user-friendly message instead of just storing the data into VARCHAR9100) because it’ll get truncated and you might not notice

Yep, I had the same idea earlier today.

Okay, sounds good.

BTW…

This may sound like a funny question, but does Google have a limit on the length of what we are calling a “slug”?

By that, I mean does Google maybe ignore the part of the slug over a certain number of characters when indexing and what-not?!

So, if my slug was…

i-really-like-reading-associated-press

…but Google chopped things off after 25 character, the to Google, it would be…

i-really-like-reading-ass

(And, hey, who doesn’t?!) :smiley: :rofl: :angel5:

Debbie
:wink:

i don’t think google knows what a slug is, so why would google truncate it?

One of the key reasons for creating slugs is that Search Engines are supposed to like them.

I don’t know how, but Google certainly uses the URL - especially the slug - to index things.

So, if Google had a limit of 25 characters, then it would index

i-really-like-reading-ass

instead of indexing…

i-really-like-reading-associated-press

And it might think my website or at least the web page in question about a topic entirely different than what it actually is about.

The logic is the same as what would happen if your Title or Description got chopped off.

If your Title read…

This is a really really awesome web page that is many focus on dealing with CSS Tips

…then you would get indexed the same as if you had a title of…

CSS Tips & Tricks

Follow me?!

Debbie

i understand that search engines know what urls are

i don’t think they know what slugs are