出色的URL设计示例

Here’s Kyle Aster on why thoughtful URL design is important (in 2010):

这是Kyle Aster在2010年谈论为什么URL设计重要的原因:

URLs are universal. They work in Firefox, Chrome, Safari, Internet Explorer, cURL, wget, your iPhone, Android and even written down on sticky notes. They are the one universal syntax of the web. Don’t take that for granted.

URLs是通用的。它们在Firefox、Chrome、Safari、Internet Explorer、cURL、wget、你的iPhone、Android甚至写在便利贴上都能使用。它们是网络的一种通用语法。不要把这当作理所当然。

I love this reminder of the ubiquity of URLs. They’re not just for typing into browser bars. They’re used in a plethora of ways:

我喜欢这个提醒,URL的普遍性。它们不仅仅是用于在浏览器地址栏中输入。它们以各种方式使用:

  • As targets for scripting and scraping and other programmatic data retrieval.
  • 作为脚本和爬虫以及其他程序化数据检索的目标。
  • As references, printed in the footnotes and appendixes of physical books.
  • 作为参考,印在纸质书籍的脚注和附录中。
  • As actionable triggers accessible via physical mediums, e.g. scannable QR codes or IoT device buttons.
  • 作为可通过物理介质触发的可操作触发器,例如可扫描的QR码或物联网设备按钮。
  • And more!
  • 还有更多!

When I reflect on examples of great URL design[1] I’ve encountered through the years — URLs that, when I saw them, I paused and thought “Wow, that’s really neat!” — these are a few that come to mind.

当我回顾多年来遇到的优秀 URL 设计示例[1]时,当我看到它们时,我会停下来想:“哇,这真的很棒!”这是我想到的一些示例。

StackOverflow

StackOverflow

StackOverflow was the first place I remember encountering URLs that struck a nice balance between the needs of computers and humans.

StackOverflow是我记得第一个在URL中很好地平衡了计算机和人类需求的地方。

The URLs follow a pattern like this:

这些URL遵循以下模式:

/questions/:id/:slug

/questions/:id/:slug

:id is a unique identifier for the question that reveals nothing about the content. :slug, on the other hand, is a human-readable paraphrasing of the question that allows you to understand the question without ever actually going to the website.

:id是一个唯一标识符,不透露任何关于内容的信息。另一方面,:slug是对问题的可读性概括,使您能够在不实际访问网站的情况下理解问题。

The beauty is :slug is an optional parameter in the URL. For example:

美妙之处在于URL中的:slug是一个可选参数。例如:

stackoverflow.com/questions/16245767

stackoverflow.com/questions/16245767

Tells you nothing about the question b...

开通本站会员,查看完整译文。

首页 - Wiki
Copyright © 2011-2024 iteam. Current version is 2.124.0. UTC+08:00, 2024-05-02 09:02
浙ICP备14020137号-1 $访客地图$