URLs: Dash vs. Underscore [closed]

2019-01-12 17:01发布

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?

18条回答
Anthone
2楼-- · 2019-01-12 17:28

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.

查看更多
Summer. ? 凉城
3楼-- · 2019-01-12 17:32

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.

查看更多
对你真心纯属浪费
4楼-- · 2019-01-12 17:33

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.

查看更多
爱情/是我丢掉的垃圾
5楼-- · 2019-01-12 17:33

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

查看更多
来,给爷笑一个
6楼-- · 2019-01-12 17:35

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
查看更多
爷的心禁止访问
7楼-- · 2019-01-12 17:35

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
查看更多
登录 后发表回答