Question

Should it be /about_us or /about-us?

From usability point of view, I personally think /about-us is much better for end-user yet Google and most other websites (and javascript frameworks) use underscore naming pattern. Is it just matter of style? Are there any compatibility issues with dashes?

Was it helpful?

Solution

This is just a guess, but it seems they picked the one that people most probably wouldn't use in a name. This way you can have a name that includes a hyphenated word, and still use the underbar as a word delimiter, e.g. UseTwo-wayLinks could be converted to use_two-way_links.

In your example, /about-us would be a directory named the hyphenated word "about-us" (if such a word existed, and /about_us would be a directory named the two-word phrase "about us" converted to a single string of non-white characters.

OTHER TIPS

From Google Webmaster Central

Consider using punctuation in your URLs. The URL http://www.example.com/green-dress.html is much more useful to us than http://www.example.com/greendress.html. We recommend that you use hyphens (-) instead of underscores (_) in your URLs.

Here are a few points in favor of the dashes:

  • Dashes are recommended by Google over underscores (source).
  • Dashes are more familiar to the end user.
  • Dashes are easier to write on a standard keyboard (no need to Shift).
  • Dashes don't hide behind underlines.
  • Dashes feel more native in the context of URLs as they are allowed in domain names.

It's not just dash vs. underscore:

  • text with spaces
  • textwithoutspaces
  • encoded%20spaces%20in%20URL
  • underscore_means_space
  • dash-means-space
  • plus+means+space
  • camelCase
  • PascalCase
  • " quoted text with spaces" (and single quote vs. double quote)
  • slash/means/space
  • dot.means.space

Google did not treat underscore as a word separator in the past, which I thought was pretty crazy, but apparently it does now. Because of this history, dashes are preferred. Even though underscores are now permissible from an SEO point of view, I still think that dashes are best.

One benefit is that your average semi-computer-illiterate web surfer is much more likely to be able to type a dash on the keyboard, they may not even know what the underscore is.

I used to use underscores all the time, now I only use them for parts of a web site that I don't want anyone to directly link, js files, css, ... etc.

From an SEO point of view, dashes seem to be the preferred way of handling it, for a detailed explanation, from the horses mouth http://www.mattcutts.com/blog/dashes-vs-underscores/.

The other problem that seems to occur, more with the general public than programmers, is that when a hyperlink with underscores is underlined, you can't see the underscore. Advanced users will work it out, but Joe Public probably won't.

Still use underscores in code in preference to dashes though - programmers understand them, most other people don't.

Jeff has some thoughts on this: https://blog.codinghorror.com/of-spaces-underscores-and-dashes/

There are drawbacks to both. I would suggest that you pick one and be consistent.

The SEO guru Jim Westergren tested this back in 2005 from a strict SEO perspective and came to the conclusion that + (plus) was actually the best word delimiter. However, this doesn't seem reasonable and may be due to a bug in the search engines' algorithms. He recommends - (dash) for both readability and SEO.

I'm more comfortable with underscores. First of all, they match in with my regular programming experience of variable_names_are_not-subtraction, second of all, and I believe this was mentioned already, words can have hyphens, but they do not ever have underscores. To pick a really stupid example, "Nation-state country" is different from "nation state country". The former translates something like "the land of nation-states" (think "this here is gun country! Best move along, y'hear?"), whereas the latter looks like a list of sometime-synonyms. http://example.com/nation-state-country/ doesn't appear to mean the same as http://example.com/nation-state_country/, and yet, if hyphens are delimiters/"space"s in addition to characters in words, it can. The latter seems more clear as to the actual purpose, whereas the former looks more like that list, if anything.

Underscores replace spaces where whitespace is not allowed. Dashes (hyphens) can be part of a word, thus joining words with hyphens that already include hyphens is ugly/confusing.

Bad:

/low-budget-movies

Good:

/low-budget_movies

I think dash is better from a user perspective and it will not interfere with SEO.

Not sure where or why the underscore convention started.

A little more knowledgeable debate

I prefer dashes on the basis that an underscore might be obscured to an extent by a link underline. Textual URLs are primarily for being recognised at a glance rather than being grammatically correct so the argument for preserving dashes for use in hyphenated words is limited.

Where the accuracy of a textual URL is important is when reading it out to someone, in which case you don't want to confuse an underscore for a space (or vice-versa).

I also find dashes more aesthetically pleasing, if that counts for anything.

For end-user view i prefer "about-us" or "about us" not "about_us"

Personally, I'd avoid using about-us or about_us, and just use about.

Some older web hosting and DNS servers actually have problems parsing underscores for URLs, so that may play a part in conventions like these.

I personally would avoid all dashes and underscores and opt for camelCase or PascalCase if its in code.

The Wikipedia article on camelCase explains a bit of the reasoning behind it's origins. They amount to

  1. Lazy programmers who didn't like reaching for the _ key
  2. Potential confusion about readability
  3. The "Alto" keyboard at xerox PARC that had no underscore key.

If the user is to see the string then I'd do none of the above and use "About us." or "AboutUs" if I had to as camelCase has spread to common usage in some areas such as product names. i.e ThinkPad, TiVo

Spaces are allowed in URL's, so you can just use "/about us" in a link (although that will be encoded to "/about%20us". But be honest, this will always be personal preference, so there is no real answer to be given here.

I would go with the convention that dashes can appear in words, so spaces should be converted to underscores.

Better use . - / as separators, because _ seems not to be a separator.

http://www.sistrix.com/blog/832-how-long-may-a-linktext-be.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top