可以在 URL 中包含 ID 吗?

发布于 2024-07-10 22:54:56 字数 247 浏览 10 评论 0原文

嗯,我的问题很简单。

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

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

Well, my question is simple.

Does the ID affect the position of a webpage on Google ?
I have links like this
http://example.com/news/title-slug/15/
and people say to me that I should remove the ID from the URL.

And I belive that is not true. By my logic, you can't depend on the title's slug. I know it should work perfectly fine if there aren't two pages that have the same title, but why should I remove the ID if there is no harm when it's there.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

感情洁癖 2024-07-17 22:54:56

是的,把它留在那里。

Google 没有义务尝试事后猜测 URL 的每个元素代表什么,并据此更改其索引。

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

Yes, leave it there.

Google has no business trying to second-guess what each element of a URL represents and changing its index based on that.

URLs by their nature can map to any resource, and I'm pretty sure Google recognises that. All you should do is ensure that multiple URLs don't have the same content by using redirects. So, for example, http://example.com/news/wrong-title-slug/15/ should redirect back to http://example.com/news/title-slug/15/ rather than just echo back the same page. Google doesn't really like duplicate content.

○愚か者の日 2024-07-17 22:54:56

没关系。

但我不会把它放在标题后面。 有些网址可能会比其他网址更令人困惑。

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

更好的方法是:

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

此外,您不能真正依赖标题,因为更改条目的标题意味着破坏用户的书签。 更不用说通过整数 ID 而不是 url-slug 从数据库检索条目速度更快。

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.

美胚控场 2024-07-17 22:54:56

这里的问题不是谷歌是否会接受,而是这样做是否对用户友好。

将 ID 保留在 URL 中的一个常见原因是确保 URL 是唯一的。 例如,如果这里有两个人要创建一个名为“Jon Skeet Facts”的问题,我们就会遇到问题,而通过 ID,用户会意识到它们是两个具有相同标题的不同问题。 这与需要唯一标识符的关系数据库相同。

从本质上讲,为什么要关心谷歌的想法呢? 整个搜索引擎优化行业就是一场闹剧,而这出自一个不止一次担任 SEO 顾问的人。 当您可以通过使您的网站完美地满足用户需求来映射 Google 的意图时,为什么还要遵循 Google 的要求呢? 如果你制作了一个好的网站,谷歌就会奖励你。 ID 的存在是有原因的,所以请保留它。

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.

秉烛思 2024-07-17 22:54:56

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

I think your fine leaving it in. Seems to make sense as you get the element for identification and the element for being descriptive. It is done on here after all.

墨小墨 2024-07-17 22:54:56

宙斯不会因此而击倒你。 我不喜欢其中有无意义的数字,因为它不是很有吸引力或语义。

Zeus won't strike you down for it. I prefer not to have meaningless numbers in there because it's not very attractive or semantic.

瘫痪情歌 2024-07-17 22:54:56

拥有 id 不会损害您的 SEO 排名。 在那里放置 slug 可确保页面的主要关键字将被索引,因此一切都很好。

Having the id will NOT hurt your SEO rankings. Having the slug there ensures that the page's main keywords will be indexed so it's all good.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文