大网数据广告活动
网站运营与故障问答

When you use dash as space what do you use for dash?

· 52CE 我爱测

The design decision was to automatically replace spaces with dash (-) when building URLs. This led to URLS such as example.com/user/john-smith . This was fine as long as names were "JohnSmith" and "Fred Bloggs". Then comes "Fredd…

问题原文

原帖链接 · Matthew Brown aka Lord Matt · CC BY-SA 3.0

The design decision was to automatically replace spaces with dash (-) when building URLs. This led to URLS such as example.com/user/john-smith. This was fine as long as names were "JohnSmith" and "Fred Bloggs".

Then comes "Freddy Double-Barrel" and we have a huge encoding headache. His URL is example.com/user/freddy-double-barrel which looks exactly like his name is "Freddy Double Barrel" (entirely the wrong string for looking this fellow up). So this user's profile is always 404 because there is no easy way to decode back again.

So how do I represent actual dashes when we are using dashes as spaces?

社区高分解答

原帖链接 · marcanuy · CC BY-SA 3.0

The URL does not need to contain such level of detail.

It is perfectly fine to have the url you propose: example.com/user/freddy-double-barrel for Freddy Double-Barrel.

From a SEO point of view, the url should cover two aspects:

  • be appealing to users
  • describe what the page is about

A url like example.com/user/freddy-double--barrel or example.com/user/freddy-double_barrel does not change anything, they even look a bit unnatural to me.

Most of the slugs generator strip special characters from the title to create a clean and readable url.

Consider the following example, this is the first result in Google for guillain-barre:

The webpage url is: http://www.mayoclinic.org/diseases-conditions/guillain-barre-syndrome/basics/definition/con-20025832 with guillain-barre-syndrome, but its title is: Guillain-Barre syndrome

As long as your page title, meta description and/or content properly says Freddy Double-Barrel, it is perfectly fine to keep the current slug scheme.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-07-22)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。