Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm considering implementing slugs in my blog. My blog uses MongoDB. One of the side-effects of using MongoDB is that it uses relatively long hex string IDs.




Of course, that's a relatively short title.. I have some longer ones, but intend to limit the maximum character limit for slugs to something reasonable.

At what point does a URL become so long that it hurts SEO instead of improves it? In this case, should I leave my URLs alone, or add slugs?

share|improve this question

closed as off topic by Caleb, Walter, ChrisF Oct 10 '12 at 10:04

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Not sure if this is on topic. The usability/user friendliness aspects would be more appropriate for User Experience, and SEO is more of black magic than science, not really a topic that has definitive answers. – Yannis Oct 9 '12 at 3:00
This question at Pro Webmasters covers URL length and SEO. – John Conde Oct 10 '12 at 19:31
up vote 2 down vote accepted

Matt Cutts, who fights spam at Google1, has commented on the number of words used in slugs:

Next question: what is excessive in the length of a keyword-rich URL? We have seen clients use keyword URLs that have 10 to 15 words strung together with hyphens; or blogs – we have seen them even longer there. A typical WordPress blog will use the title of the post as the post slug, unless you defined something different and you can just go on and on and on. Can you give any guidelines or recommendations in that regard?

Matt Cutts: Certainly. If you can make your title four- or five-words long – and it is pretty natural. If you have got a three, four or five words in your URL, that can be perfectly normal. As it gets a little longer, then it starts to look a little worse. Now, our algorithms typically will just weight those words less and just not give you as much credit.

The thing to be aware of is, ask yourself: “How does this look to a regular user?” – because if, at any time, somebody comes to your page or, maybe, a competitor does a search and finds 15 words all strung together like variants of the same word, then that does look like spam, and they often will send a spam report. Then somebody will go and check that out.

So, I would not make it a big habit of having tons and tons of words stuffed in there, because there are plenty of places on a page, where you can have relevant words and have them be helpful to users – and not have it come across as keyword stuffing.

Stephan Spencer: So, would something like 10 words be a bit much then?

Matt Cutts: It is a little abnormal. I know that when I hit something like that – even a blog post – with 10 words, I raise my eyebrows a little bit and, maybe, read with a little more skepticism. So, if just a regular savvy user has that sort of reaction, then you can imagine how that might look to some competitors and others.

URLs, and by extension slugs, are important for indexing, using a few actual words in them that also appear in the page will help with indexing, but overdoing it might prove counter productive. Keep in mind that you can, to a point, teach Google how to treat your URLs, through their Webmaster Tools.

Anecdotally I've noticed that the Google bot seems to really appreciate Sitemaps, a solid sitemap is perhaps a better investment of your time than worrying (too much) about the slugs.

Some further reading:

1 ...awesome job title: Head of webspam!

share|improve this answer
Hmmm.. with this in mind it makes me wonder if I should limit either number of words or raw number of characters in the slug – Earlz Oct 9 '12 at 3:24
@Earlz I have limited experience with SEO and coincidentally fired every SEO expert I've had the "pleasure" of working with to date, even if I wasn't the one who hired them. My advice would be to design your URLs to be as human friendly as possible, search engine algorithms, especially Google's, is tuned every now and then to better judge what a human would think of as friendly and useful (sometimes though it seems that their version of human is a brain damaged one, but...). Anyway, I'd probably remove the hash from the URL, it looks ugly and raw number of characters might be important. – Yannis Oct 9 '12 at 3:37
Heh, having the hash is the easiest method, though I could turn to the familiar /yearmonthday/time type method... Either way, if I'm updating URLs, I might as well do them all at once. I hate implementing more redirects than I actually need. – Earlz Oct 9 '12 at 3:47
My guess is that most titles converted to 3-6 word URLs will be unique. In the rare cases where it isn't you can always force it with a differentiator (...-2, ...-3). The hash is for you and your DB, not for any (human) user. – Peter Rowell Oct 9 '12 at 5:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.