URL 中 slug 的位置重要吗?

发布于 2024-07-16 02:55:17 字数 1562 浏览 8 评论 0原文

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

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

发布评论

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

评论(5

别念他 2024-07-23 02:55:17

最好将语义内容较少的内容推到右侧,因为它更有可能因相关内容的长度限制而被截断。 因此,您发布的第二种形式比 SO 的方式更适合 SEO 目的。 (更好的方法是使用 slug 作为真正的标识符,并将与语义内容无关的 ID 排除在外。)

It's better to push whatever has less semantic content to the right because it's more likely to get chopped off by length limits on what's considered relevant. So the second form you post would be better for SEO purposes than the way SO does it. (Better yet is using the slug as a real identifier and keeping semantic-content-free IDs out of it.)

在你怀里撒娇 2024-07-23 02:55:17

我始终遵循以下规则:在确定 URL 中对用户(实际用户或 Google)最重要的信息时,从右向左移动非常重要。 因此,您必须问自己的问题是,您是否希望用户将 ID 或标题视为页面最重要的内容。

另外,如果他们放弃电话号码而只留下标题,会发生什么情况。 页面会向右弹出,但如果你扔下小块并留下号码,会发生什么。 页面功能正常。

I always go with the Rule that it is important to move from right to left when determining the most important information in your URL for the user (an actual user or google). So the question you have to ask your self, is do you want your user to see the ID or the title as the most important thing of the page.

Also what happens if they drop off the number, and just leave the title. The page blows up right, but what happens if you drop the slug and leave the number. The page functions as normal.

不打扰别人 2024-07-23 02:55:17

不幸的是,考虑到谷歌(和大多数其他搜索引擎)的安全性是通过模糊性实现的(如果描述/解释了任何明确的方法,就会担心系统受到欺骗),因此不会有一个明确的、可证明的答案。

总的来说,你可以假设,如果它看起来很粘糊,谷歌会惩罚它,如果它看起来语义/有用,谷歌会推广它。 对于上述网址,我猜测 Google 会同等对待这两者,但这完全是猜测,除了 Google 算法工程师停在这里之外,我怀疑您是否会找到更明确的内容。

Unfortunately, given Google's (and most other search engine's) security through obscurity (fear of gaming of the system if any clear methods are described/explained), there's just not going to be a clear, demonstrable answer.

On the whole, you can assume that if it seems slimy, Google will penalize it, and if it seems semantic/useful, Google will promote it. In the case of the above url, it's my guess that Google will treat both the same, but that's entirely a guess, and outside of a Google algorithmic engineer stopping in here, I doubt you're going to find anything more definitive.

忘年祭陌 2024-07-23 02:55:17

如果 slug 位于末尾,则解析 URL 可能会容易得多。 您可以从路径的开头提取所需的值,然后忽略后面的所有内容。 (因此,slug 可能比您所拥有的更复杂,具有多个“目录”等)。 如果您将 slug 放在开头或中间,您必须能够解析它才能找到重要的内容。

Parsing the URL is probably a lot easier if the slug is at the end. You can pull out the values you need from the beginning of the path, and then just ignore everything after it. (so the slug could be even more complex than what you have, with multiple "directories", etc). If you put the slug at the beginning or the middle you have to be able to parse that out in order to find what's important.

君勿笑 2024-07-23 02:55:17
https://stackoverflow.com/questions/727281/blahblablah-lets-assume-that-this-continues-on-and-on-and-on

现在,如果您截断 https://stackoverflow.com/questions/727281/blahbla 仍然有效。

在另一种情况下: https://stackoverflow .com/questions/why-do-some-websites-add-slugs-to-the-end-of-urls/47427 被截断 https://stackoverflow.com/questions/why-do-so 将没有机会工作。

https://stackoverflow.com/questions/727281/blahblablah-lets-assume-that-this-continues-on-and-on-and-on

Now if you truncate that https://stackoverflow.com/questions/727281/blahbla still works.

In the other case: https://stackoverflow.com/questions/why-do-some-websites-add-slugs-to-the-end-of-urls/47427 truncated https://stackoverflow.com/questions/why-do-so would have no chance to work.

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