cite 属性有什么用?

发布于 2024-11-15 03:21:08 字数 423 浏览 1 评论 0原文

引用 属性指定了引用文本的源地址,但是谁使用这个信息呢?

例如:

<q cite="http://www.example.com/quote">
<p>&#8220;A quote&#8221;</p>
<footer>&#151;Person quoted</footer>
</q>

最终用户在普通浏览器中看不到引用文本的来源,那么谁使用这些信息以及如何使用?

The cite attribute specifies the address of the source of the quoted text, I think, but who uses this information?

For example:

<q cite="http://www.example.com/quote">
<p>“A quote”</p>
<footer>—Person quoted</footer>
</q>

The source of the quoted text isn't visible to the end-user in a normal browser, so who does use this information, and how?

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

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

发布评论

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

评论(7

余生共白头 2024-11-22 03:21:08

首先,您不仅可以在 blockquote 中使用 cite 属性。
您还可以在以下元素上使用 cite 属性:

<blockquote>
<del>
<ins>
<q>

为什么要在上述元素中使用 cite

指出内容的获取位置引用自、或更改或删除。


Here is what w3.org says,

用户代理可能允许用户跟踪此类引用链接,但他们
主要供私人使用(例如:通过服务器端脚本
收集有关网站编辑的统计信息),而不是为读者


现在的问题是,谁使用它?

cite 属性用于标识表单中引用的在线来源URI 的名称(例如“http://sourcewebsite.doc/document.html”)。

cite 属性的值不会在屏幕上呈现(尽管可以通过 DOM 脚本的魔力提取这种潜在有用的元数据并将其写回到网页中)。

因此,浏览器对此属性的支持被标记为“无”,但因为它具有其他潜在用途(用于搜索引擎索引、通过 DOM 脚本检索等),并且存在可能性<由于未来浏览器版本中会对该属性提供改进的本机支持,因此在使用上述元素时应使用 cite 属性。

所以,目前没有人使用它,但将来可能会在用户代理或我的搜索引擎中使用,所以最好使用它。

First, it's not only blockquote where you can use the cite attribute.
You can use the cite attribute on the following elements also:

<blockquote>
<del>
<ins>
<q>

Why would one use cite in above elements?

To point to where the content is taken from, or change or deletion is referred.


Here is what w3.org says,

User agents may allow users to follow such citation links, but they
are primarily intended for private use (e.g: by server-side scripts
collecting statistics about a site's edits), not for readers


Now, the question, who uses it?

The cite attribute is used to identify the online source of the quotation in the form of a URI (for example, "http://sourcewebsite.doc/document.html").

The value of the cite attribute isn't rendered on screen (although this potentially useful meta data could be extracted and written back into the webpage through the magic of DOM Scripting).

As such, browser support for this attribute is marked as none, but because it has other potential uses (for search engine indexing, retrieval via DOM scripting, and more) and there is the likelihood of improved native support being provided for the attribute in future browser versions, you should use the cite attribute when you use the above elements.

So, currently no one uses it, but in future maybe used in user-agent or my search engines, so better to use it.

↘紸啶 2024-11-22 03:21:08

标签和 cite 属性都是出于语义目的,这意味着它们只是为了赋予网站更多“意义”。例如,我可以使用

标签来引用,而不是使用

标签,但这对浏览器来说意义不大,并且因此,建议使用

进行引用。

标签和 cite 属性也是如此。根据 cite 属性的 MDN 定义 (

使用 or 元素上的 cite 属性来引用
来源的在线资源。

“那么谁使用这些信息以及如何使用?” - 我相信搜索引擎(例如谷歌)会使用此信息来显示文档之间的潜在链接。如果你考虑一下这一点,这是一个重点。查看下图:

Search of Samsung on Google

请注意右侧如何显示“Samsung Group”信息框。在谷歌工作的人不会写这些信息——相反,它来自维基百科。然而,当此信息也写在其他网站上时,此信息将与搜索“samsung”具有更大的相关性,并且 cite 属性将此信息链接到维基百科(从而增加了维基百科的相关性)。这就是为什么这里使用维基百科的信息,而不是一些小学网站上有关三星手机的信息。

cite 属性只是为网站提供更多含义。 Tim Berners-Lee 将语义网描述为“Web 3.0”的一个组件——换句话说,更新的 HTML 语言的许多组件只是为了给网页提供更多的含义,向 Web 3.0 更近了一步。

TL;DR - 简单来说,cite 属性只是为网页提供更多含义,并且可以用于搜索引擎以实现更好的网络链接。

Both the <cite> tag and the cite attribute are for semantic purposes, which means that they are simply for giving a website more "meaning". For example, I could use a <div> tag for a quote, rather than using a <blockquote> tag, but this provides less meaning to the browser, and hence using <blockquote> is recommended for quotes.

The same is with the <cite> tag and cite attributes. As per the MDN definition for the cite attribute (link here):

Use the cite attribute on a or element to reference
an online resource for a source.

"so who does use this information, and how?" - I believe that search engines (e.g. Google) would use this information to show potential links between documents. If you think about this it is a major point. Check out the image below:

Search of Samsung on Google

Notice how it shows the "Samsung Group" information box on the right. The guys who work at Google don't write this information - rather, it is sourced from Wikipedia. However, this information would be of greater relevance to the search "samsung" when this information is also written on other websites, with the cite attribute linking this information to Wikipedia (hence increasing the relevancy of Wikipedia). This is why Wikipedia's information is used here, and not some primary school's website regarding Samsung phones.

The cite attribute simply provides more meaning to the website. Tim Berners-Lee has described the semantic web as a component of "Web 3.0" - in other words, many components of the updating HTML language are simply to provide more meaning onto the webpage, as a step closer to Web 3.0.

TL;DR - in simpler terms, the cite attribute is just to provide more meaning to the web page, and may be used for search engines for better web linkage.

皇甫轩 2024-11-22 03:21:08

W3C 有这样的说法:

该属性的值是指定源文档或消息的 URI。此属性旨在提供有关借用引用的来源的信息。

它是不可见的,我想不出它在哪里使用,除了搜索引擎。

W3C has this to say:

The value of this attribute is a URI that designates a source document or message. This attribute is intended to give information about the source from which the quotation was borrowed.

It's not visible and I can't think of anywhere it's used except perhaps by search engines.

情话墙 2024-11-22 03:21:08

它旨在由收集和整理数据的机器使用,例如。搜索引擎,但它可以被任何机器使用。其目的是使网页更加系统化,以便于机器阅读。因为他们无法仅根据上下文理解文本的哪一部分代表引用和引用。
您可以查找语义网以获取更多信息。
http://en.wikipedia.org/wiki/Semantic_Web

It is meant to be used by machine which collect and arrange data eg. search engines, but it can be used by any machine. It is meant to make webpages more systematic to be read by machine. As they can not understand which part of text represent citation and quote based on only context.
you can look up Semantic Web for more information.
http://en.wikipedia.org/wiki/Semantic_Web

衣神在巴黎 2024-11-22 03:21:08

是的,最终用户看不到报价来源。所以这只是对来源的引用。

来自 WHATWG.ORG 的定义

aq 元素内的内容必须是
引用另一个来源,其
地址(如果有)可以引用
在 cite 属性中。消息来源可能是
是虚构的,如引用时
小说或剧本中的人物。

如果 cite 属性存在,则
可能必须是有效的 URL
被空间包围。

Yes, the source of the quotation isn't visible to end user. So it's just a reference to the source.

Definition from WHATWG.ORG:

Content inside a q element must be
quoted from another source, whose
address, if it has one, may be cited
in the cite attribute. The source may
be fictional, as when quoting
characters in a novel or screenplay.

If the cite attribute is present, it
must be a valid URL potentially
surrounded by spaces.

围归者 2024-11-22 03:21:08

引用自 W3Schools:

任何主要浏览器都不支持 cite 属性。
但是,搜索引擎可能会使用它来获取有关报价的更多信息。

http://www.w3schools.com/tags/att_q_cite.asp

Quoted from W3Schools:

The cite attribute is not supported by any of the major browsers.
However, search engines may use it to get more information about the quotation.

http://www.w3schools.com/tags/att_q_cite.asp

泅人 2024-11-22 03:21:08

它只是另一个元数据块,服务器端脚本可以使用它来收集统计数据,或者前端开发人员可以使用它来添加功能(他们可以选择打印源代码,允许访问原始源代码等)。

将原始源代码写在某个地方是一个很好的做法,尽管它实际上对最终用户来说并不是很有用。

It's just another meta data chunk that can be used by server side scripts to collect statistics or by front end developpers to add functionnalities (they can choose to print the source, allow to access the original source, etc...).

It's just a good practice to have the original source written somewhere although it is actually not very useful for the end user.

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