当它们是基于用户生成的内容设计URI的最好方法 [英] Best way to design URIs when they are based on user generated content

查看:126
本文介绍了当它们是基于用户生成的内容设计URI的最好方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的系统,我们已经生成内容的网页URL地址的内容,包括标题,是基于用户。我试图找出一种平衡SEO,易读性和弹性最好的设计。

In our system, we have URLs for pages where the content, including the title, is based on user generated content. I'm trying to figure out the best design that balances SEO, human readability and resiliency.

我一直在阅读这个一堆材料,包括回来的路上蒂姆·伯纳斯 - 李的文件:的酷的URI不要更改

I've been reading a bunch of material on this, including Tim Berners-Lee's document from way back: Cool URIs don't change.

作为一个例子,假设我有,用户所提交的内容(一措辞审查)和书名和作者书评网站。

As an example, imagine I have a book review site where users are submitting content (a worded review) and the book's title and author.

所以,如果他们提交的图书审查双城记狄更斯的作者(用户无意中mispells吧)。该URL可以是:

So if they submitted a book review for A Tale of Two Cities (user unintentionally mispells it) with Author of Charles Dickens. The URL could be:

http://foo.com/charles-dickens/a-故事-的两型城市

后来,如果加入另一本书狄更斯,也可能是:

Later on, if another book by Dickens is added, it could be:

http://foo.com/charles-dickens/oliver-twist

然后 http://foo.com/charles-dickens/ 可能是该网站上的所有审查书籍清单。

Then http://foo.com/charles-dickens/ could be a list of all the reviewed books on the site.

然而,问题开始发挥作用,如果做出改变预定冠军。试想一下,用户拼写错误的东西,像两市的故事,那么它以后改正。这也将改变网址,将打破任何外部链接到网页,网页级别等。

However, the problem comes into play if a change is made to book title. Imagine the user mispelled something, like A Tale of Two City, then it's later corrected. This would also change the URL and would break any external links to that page, pagerank, etc.

什么是处理这类问题的推荐的方法?选择我看到:

What is the recommended way to handle this type of problem? Options I see:


  1. 第一次提交胜:后的初步建立无需更改URL是可能的

  1. First commit wins: No changes to URL are possible after it's initially established

过去犯下胜:始终更改URL。所以,如果有产生变化到用户的内容,修改URL。通过这种方法,无论是旧的URL是死还是一个线索是所有的URL变化preserved和他们都仍然起作用。计算器,似乎这一点。

Last commit wins: Always change the URL. So if there's a change to the User generated content, revise the URL. With this approach, either the old URL is dead or a trail is preserved of all the URL changes and all of them still function. Stackoverflow seems to to this.

请在UGC不是基地网址:忽略用户生成的内容,只是拿出不是基于它的URL。因此,URL可以是 http://foo.com/reviews/1234

Don't base URL on UGC: Ignore the user generated content and just come up with URLs not based on it. So url could be http://foo.com/reviews/1234.

什么是人的思想对这个?

What are people's thoughts on this?

推荐答案

您是稍有不妥;堆栈溢出结合#2,#3。一个问题有一个特定ID,而这一切,你需要找到的问题。例如,这个问题的id是 11011252 。您可以访问的问题<一href=\"http://stackoverflow.com/questions/11011252\"><$c$c>http://stackoverflow.com/questions/11011252,无需添加URL的一部分(或你叫它URI在这种情况下?)从问题产生的称号。事实上,将得到自动的上涨(无论是通过重定向或某些其他方法),当您使用titleless地址。

You're slightly wrong; Stack Overflow combines #2 and #3. A question has a specific id, and that's all you need to locate the question. For example, this question's id is 11011252. You can access the question with http://stackoverflow.com/questions/11011252, no need to add the portion of the URL (or would you call it a URI in this case?) generated from the question title. In fact, that will get automatically tacked on (whether by redirect or some other method) when you use the titleless address.

更妙的是,你可以添加任何你想要的(在合理范围内,我想)到地址的末端。 <一href=\"http://stackoverflow.com/questions/11011252/this-text-will-be-ignored\"><$c$c>http://stackoverflow.com/questions/11011252/this-text-will-be-ignored将带你到这个问题没有任何问题。

Even better, you can append whatever you want (within reason, I suppose) to the end of the address. http://stackoverflow.com/questions/11011252/this-text-will-be-ignored will take you to the question without any problem.

Stack Overflow是不是唯一的网站,这样做,要么;我见过专注于用户生成内容的许多其他网站遵循相同的协议/无论你怎么称呼它。这似乎是最好的方法来与去,因为它结合了#3的优点和#2的优势(基本URI保持不变)(网址中包含有关其目标,哪些用户会喜欢一些信息),以及最佳的一切意味着你不会得到任何URI冲突,如果两个人生成相同的非唯一标识符的内容。

Stack Overflow isn't the only website that does this, either; many other sites I've seen focused on user-generated content follow the same protocol/whatever you call it. It seems like the best method to go with, as it combines the advantages of #3 (underlying URI remains the same) with the advantages of #2 (the URL contains some information about its target, which users will like), and best of all means you won't get any URI conflicts if two people generate content with the same non-unique identifiers.

这篇关于当它们是基于用户生成的内容设计URI的最好方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆