3

好吧,我的问题很简单。

ID 是否会影响网页在 Google 上的位置?我有这样的链接 http://example.com/news/title-slug/15/ ,人们对我说我应该从 URL 中删除 ID。

我相信那不是真的。按照我的逻辑,你不能依赖标题的蛞蝓。我知道如果没有两个具有相同标题的页面,它应该可以正常工作,但是如果 ID 在那里没有任何伤害,我为什么要删除它。

4

6 回答 6

11

是的,把它放在那里。

谷歌没有业务试图猜测 URL 的每个元素代表什么并基于此更改其索引。

URL 本质上可以映射到任何资源,我很确定 Google 能够识别这一点。您应该做的就是通过使用重定向确保多个 URL 没有相同的内容。因此,例如,http://example.com/news/wrong-title-slug/15/应该重定向回http://example.com/news/title-slug/15/而不是仅仅回显同一页面。谷歌真的不喜欢重复的内容。

于 2009-01-04T18:16:28.030 回答
9

It's fine.

But I would not put that behind the title-slug though. Some url might get more confusing than the others.

http://example.com/entry/how-to-solve-question-45/15

a better one would be :

http://example.com/entry/15/how-to-solve-question-45

Besides, you can't really rely on just the title-slug, because changing the title of an entry means breaking user's bookmark. Not to mention that it is faster to retrieve an entry from the database by an integer ID instead of an url-slug.

于 2009-01-04T18:53:50.043 回答
3

The problem here is not whether Google will accept it, but whether or not doing so is user-friendly.

A common reason for keeping the ID in a URL is to ensure that the URL is unique. For example, if two people on here were to create a question named "Jon Skeet Facts" we'd have a problem, whereas with the ID the users are aware that they are two different questions with the same title. This is the same as with relational databases where a unique identifier is required.

In essence, why care what Google thinks? The whole Search Engine Optimisation industry is a farce, and this is coming from someone who has been paid more than once as a SEO Consultant. Why follow what Google wants when you can map Google's intentions by making your website perfect for the user? If you make a good website Google will reward you. The ID has a reason to be there, so keep it in.

于 2009-01-10T01:50:46.197 回答
2

我认为你可以把它留在里面。当你得到用于识别的元素和用于描述的元素时,这似乎是有道理的。毕竟是在这里完成的。

于 2009-01-04T18:09:28.463 回答
2

宙斯不会因此而打倒你。我不想在那里有无意义的数字,因为它不是很有吸引力或语义。

于 2009-01-04T18:24:04.737 回答
2

拥有 id 不会损害您的 SEO 排名。有 slug 确保页面的主要关键字将被索引,所以一切都很好。

于 2009-01-04T22:48:10.460 回答