博客网址重要吗?

I had an interesting e-conversation with Rob Howard and Scott Watermasysk today. I had noticed recently that a number of blogs I'd visited had things like _2D00_  and similar codes in their URLs. There was a forum post a while back (July of 2006) that asked about things like hyphens getting encoded in some builds of CS2.1.

我今天与Rob HowardScott Watermasysk进行了有趣的电子对话。 最近我注意到,我访问过的许多博客的网​​址中都包含_2D00_之类的内容以及类似的代码。 不久前(2006年7月)有一个论坛帖子,询问连字符在某些CS2.1版本中进行编码的情况。

There were a bunch of posts on http://www.asp.net that had URLs like: .../2006/09/07/Startup-doesn_2700_t-always-mean-venture-capital... where the 2700 was a single quote or .../2006/09/05/Should-tags-be-moderated_3F00_... where 3F00 was a "?". The non-latin characters in these cases were being encoded in the URL with their Unicode Code Point. This was a bug in a beta of CS that was quickly fixed, but it got me thinking about URLs in blog engines and more generally. These particular URLs and their untidiness really irked me.

http://www.asp.net上有很多帖子,其URL类似于: ... / 2006/09/07 / Startup-doesn_2700_t-always-mean-venture-capital ...其中2700是单引号或... / 2006/09/05 /应该标记为moderated_3F00 _...其中3F00是“?”。 在这种情况下,非拉丁字符使用其Unicode Code Point编码在URL中。 这是CS的Beta版中的一个错误,该错误很快得到修复,但它让我考虑了博客引擎以及更一般的URL。 这些特定的网址及其笨拙确实让我感到讨厌。

到达同一个地方的不同方式 (Different Ways to Get to the Same Place)

Personally I like URLs that use Pascal Casing, like the one for this post, for example, is:

我个人喜欢使用Pascal Casing的URL,例如,本文中的URL是:

http://www.hanselman.com/blog/AreBlogURLsImportant.aspx

http://www.hanselman.com/blog/AreBlogURLsImportant.aspx

Although URLs are technically supposed to be case sensitive, and you used to see that a lot when URLs belied the underlying case -sensitivity of the file system, they aren't in our case. The only thing that would make it better, IMHO, is the removal of the .aspx extension. More on that later.

尽管从技术上讲URL应该是区分大小写的,并且您经常会看到URL掩盖了文件系统的区分大小写的敏感性,但是在我们的案例中却并非如此。 唯一使它更好的东西,恕我直言,是删除了.aspx扩展名。 以后再说。

Years ago DasBlog had really lame URLs and Jeff Atwood picked on us. ;) These urls live on in some comments pages within DasBlog in some cases, unfortunately.

多年前, DasBlog的URL确实很la脚,而Jeff Atwood选择了我们。 ;)在某些情况下,不幸的是,这些网址仍存在于DasBlog的某些评论页面中。

We started using the blog title to general the URL. This, of course, has problems when you change a title after a pile of folks link to the original URL, but unless you want the engine to keep track of every title a post has ever had and 301 to the "final URL," you've got a nasty problem. Anyway...

我们开始使用博客标题来概括URL。 当然,当您在一大堆人链接到原始URL之后更改标题时,这会出现问题,但是除非您希望引擎跟踪帖子曾经拥有的每个标题以及“最终URL”为301,否则您会遇到问题有一个讨厌的问题。 无论如何...

There's a number of options in DasBlog that affect your URLs, although DasBlog canonicalizes URLs internally and will always accept any of these formats without breaking your URLs. That is, you can change your URLs scheme and you won't be penalized.

有一些期权DasBlog影响您的网址,虽然DasBlog canonicalizes网址内部,永远接受任何一种格式而不破坏你的网址。 也就是说,您可以更改URL方案,并且不会受到处罚。

There's options to use a + for a space, as well as including the date, so any of these are potentially valid:

有一些选项可以使用+来表示空格,还包括日期,因此以下任何一项都可能有效:

一种网址格式对搜索引擎友好吗? (Is One URL Format more Search Engine Friendly?)

A number of folks have said they preferred hyphens over pluses, specifically that it helps Google. Rob mentioned during our email discussion:

许多人说,他们喜欢连字符而不是加号,特别是它可以帮助Google。 Rob在我们的电子邮件讨论中提到:

The hyphens, however, are something you guys should investigate using for DasBlog. Search engines actually look at the URL for keywords. The hyphen is considered a word-break indicator, i.e. HelloWorld to Google appears as "HelloWorld" whereas Hello-World is "Hello" and "World". The underscore is also considered a word-break, but given less points.

但是,连字符是您应该研究用于DasBlog的东西。 搜索引擎实际上会查看关键字的URL。 连字符被视为断字指示符,即Google的HelloWorld显示为“ HelloWorld”,而Hello-World为“ Hello”和“ World”。 下划线也被认为是断字,但得分较低。

I'm wasn't sure about this, and initially was skeptical, but it he's right - mostly. However, it seems to matter less and less, as Google seems to have added some smarts.

我不确定这一点,起初对此表示怀疑,但他是对的-大多数情况下。 但是,这似乎越来越不重要了,因为Google似乎增加了一些技巧。

If you Google for "happybirthdaytomiiwiireview" all-one-word, you'll get my post on the Nintendo Wii with the URL highlighted. You'll also get that post if you Google for "Happy Birthday to Mii" as a list of words, or as a phrase with surrounding quotes because it also happens to be the title.

如果您用Google词“ happybirthdaytomiiwiireview ”全词,您将在Nintendo Wii上看到我的帖子,其中URL突出显示。 如果您将GoogleMii生日快乐”,您也可以通过单词列表或带有引号的短语获得该帖子,因为它也恰好是标题。

ASIDE: Oddly, if you Google for the phrase with hyphens (which is odd, in itself) as in happy-birthday-to-mii you'll get less results than if you do it with quotes. Not that there's any reason to do that.

旁白:奇怪的是,如果您像生日快乐到mii一样使用Google连字符(本身是奇数)来搜索短语,则获得的结果要少于用引号引起来的结果。 并不是有任何理由这样做。

Notice in the screenshot below how the word "Mii" appears bold in the URL. Not in the title, in the URL. That implies to me that Google either cares about casing, in this case the Pascal Casing of my blog's URL, or that it picked "Mii" up as a fragment and really cares about fragments of things in URLs.

请注意,在下面的屏幕截图中,“ Mii”一词在网址中的显示方式为粗体不在标题中,在URL中。 在我看来,这意味着Google要么在乎大小写(在本例中是我博客URL的Pascal Casing),要么在选择“ Mii”作为片段,并真正在乎URL中的事物片段。

Let's see which it is. If we search for "Happy Birthday to Mi" with just one i in "Mii" - where "Mi" is a fragment of "Mii" - we don't see my post anywhere at all, which implies, to me at least, that Pascal Casing in a Blog Post is likely as effective from Google's perspective in delimiting spaces as is a hyphen, so from a Search Engine Optimization (SEO) perspective, hyphens versus Pascal Casing versus whatever is pretty much a moo point.

让我们看看它是什么。 如果我们在“ Mii”中仅用一个i搜索“给Mi的生日快乐”(其中“ Mi”是“ Mii”的片段),那么我们根本看不到我的帖子,这至少对我而言意味着帕斯卡套管在博客中很可能从谷歌在界定空间的角度有效的是一个连字符所以从搜索引擎优化(SEO)的角度,连字符与Pascal大小写与不管是相当多的哞点

Not moot, rather, "moo" like a cow's opinion. It just doesn't matter. It's moo.

不是无意义的,而是像牛的意见那样“无聊” 没关系。 哎呀

So, pick the URL style that makes you feel good, I say.

所以,我说,选择一种让您感觉良好的URL样式。

URL的许多选项 (Many Options for URLs)

Scott Water has used ISAPI_Rewrite to completely remove the .aspx extension from his site, and he has nice clean URLs like http://scottwater.com/blog/archive/url-rewriting-via-isapi-rewrite/. He also has nice "hackable" URLs like http://scottwater.com/blog/search/hanselman/ which is pretty sweet. You too can remove the .ASPX extension from your ASP.NET site using ISAPI_Rewrite.

斯科特·沃特(Scott Water )使用ISAPI_Rewrite从他的站点中完全删除了.aspx扩展名,并且他拥有漂亮的干净URL,例如http://scottwater.com/blog/archive/url-rewriting-via-isapi-rewrite/ 。 他还拥有不错的“可入侵” URL,例如http://scottwater.com/blog/search/hanselman/ ,它非常漂亮。 您也可以使用ISAPI_Rewrite从ASP.NET站点中删除.ASPX扩展名

Here's some example URL styles I've seen out there in Blog Land:

以下是我在Blog Land中看到的一些示例URL样式

  • Subtext .../blog/archive/2007/02/11/Subtext_v1.9.4_quotWindwardquot_Edition_Released.aspx

    子文字... / blog / archive / 2007/02/11 / Subtext_v1.9.4_quotWindwardquot_Edition_Released.aspx

  • CS with ISAPI_Rewrite .../blog/archive/twitter-for-windows/

    带有ISAPI_Rewrite的CS ... / blog / archive / twitter-for-windows /

  • Typo - .../articles/2007/03/27/microsoft-technical-summit

    错字-... / articles / 2007/03/27 / microsoft-technical-summit

  • DasBlog .../weblog/StringFormattingFun.aspx

    DasBlog ... / weblog / StringFormattingFun.aspx

  • DasBlog with Dates - .../2007/03/27/Abschlussbericht+Zum+NET+Wintercamp+2007.aspx

    带日期的DasBlog -... / 2007/03/27 / Abschlussbericht + Zum + NET + Wintercamp + 2007.aspx

  • Radio Userland .../2007/04/05/itsNotTheCoverOfRollingSto.html

    Radio Userland ... / 2007/04/05 / itsNotTheCoverOfRollingSto.html

  • MovableType - .../blog/archives/000093.html

    MovableType -... / blog / archives / 000093.html

  • Blogger - .../2007/04/mulan.html

    Blogger -... / 2007/04 / mulan.html

  • Drupal - .../node/133257

    Drupal -... /节点/ 133257

  • Blogware - .../blog/_archives/2006/8/18/2242665.html

    Blogware -... / blog / _archives / 2006/8/18 / 2242665.html

Yes, there's 1,000 blogging engines out there, each with its own URL style, and yes, this is not an exhaustive list.

是的,那里有1000个博客引擎,每个博客引擎都有自己的URL样式,是的,这并不是一个详尽的列表。

URL中的尾部斜杠并从URL中删除技术 (The Trailing Slash in a/an URL and removing Technology from your URL)

Note that in ScottWater's case, the URLs are lower-case and include the trailing /.

请注意,在ScottWater的情况下,URL是小写的,并包含结尾的/。

There's a lot of controversy about the Trailing Slash. I've always felt that the trailing slash implied we were visiting a directory, while no slash implied we were visiting a page. Simon Willison seems to advocate for the trailing slash as in his comment at http://jessey.net/archive/2004/05/31/rewritten/.

关于“尾随斜线”存在很多争议。 我一直觉得斜杠暗示我们正在访问目录,而斜杠暗示我们正在访问页面。 西蒙·威利森(Simon Willison)似乎提倡用斜线结尾,http://jessey.net/archive/2004/05/31/rewrite/上的评论所示。

Personally, I like the trailing slash only for the home page of this blog and set it up that way earlier this year. At least I picked one, as these things matter.

就我个人而言,我只喜欢在此博客首页后面加上斜线,并于今年早些时候对此进行了设置这些事情很重要,至少我选了一个。

What I'd really like to do is remove the Technology from my URLs. I could remove the .aspx extension from my blog's URLs by:

我真正想做的是从URL中删除该技术。 我可以通过以下方式从博客的网址中删除.aspx扩展名:

  • Making it output Permalink URLs with out .aspx

    使它输出不带.aspx的永久链接URL
  • Adding a ISAPI_Rewrite rule to add the .aspx before the request gets to ASP.NET

    添加ISAPI_Rewrite规则以在请求到达ASP.NET之前添加.aspx
  • Add some magic dust in ASP.NET 1.1 or A Form Control Adapter in ASP.NET 2.0 to change the HTML FORM Action in the case of a Post Back.

    在回发的情况下,在ASP.NET 1.1或ASP.NET 2.0的表单控件适配器中添加一些魔术,以更改HTML FORM Action。

Of course, I'd need to do this without invalidating all the existing permalinks out there. The idea being that once you've put a permalink out there, it's out there. Forever. Only Feed Readers and Search Bots will respect a 301 and update their record of those links. All that static HTML out there cares not about your pretty URLs.

当然,我需要做到这一点而又不使所有现有的永久链接无效。 这样的想法是,一旦您将永久链接放到那里,它就会在那里。 永远。 只有Feed阅读器和搜索机器人会尊重301并更新其这些链接的记录。 那里所有的静态HTML都不关心您的漂亮URL。

It's probably too late for me, Dear Reader, but perhaps not for you and your URLs. Pick a scheme and be excited about it, for these are religious issues that will never be solved.

亲爱的读者,对我来说可能为时已晚,但对您和您的URL而言可能不是。 选择一个方案并对它感到兴奋,因为这些是宗教问题,将永远无法解决。

结论 (Conclusion)

I don't think ScottWater will mind me quoting him directly from a private email, in this case, to end this blog post:

我认为ScottWater不会介意我直接从私人电子邮件中引用他来结束此博客文章:

What I meant is that if the goal is SEO, nice URLs are well…nice, but there are way better things you can do, such as writing relevant content. - Scott Watermasysk

我的意思是,如果目标是SEO,那么不错的URL很好……但是,您可以做一些更好的事情,例如编写相关内容 -斯科特·沃特马斯克(Scott Watermasysk)

It's true! I should stop now.

这是真的! 我现在应该停止。

翻译自: https://www.hanselman.com/blog/are-blog-urls-important

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值