META 元素

<!ELEMENT META - O EMPTY               -- generic metainformation --> 
<!ATTLIST META 
  %i18n;                               -- lang, dir, for use with content --   
http-equiv  NAME           #IMPLIED  -- HTTP response header name  --
 name        NAME           #IMPLIED  -- metainformation name --   
content     CDATA          #REQUIRED -- associated information --   
scheme      CDATA          #IMPLIED  -- select form of content --   > 

Start tag: required, End tag: forbidden

开始标签:必须,结束标签:禁止使用

Attribute definitions

属性定义

For the following attributes, the permitted values and their interpretation are profile dependent:

对于下列属性,其允许的取值以及它们的解释依赖于其相关的profile:

name = name [CS]
This attribute identifies a property name. This specification does not list legal values for this attribute
该属性标识一个属性的名字。本规范没有列出该属性的合法取值.
content = cdata [CS]
This attribute specifies a property's value. This specification does not list legal values for this attribute
该属性指定了属性值。本规范没有列出该属性的合法取值。
scheme = cdata [CS]
This attribute names a scheme to be used to interpret the property's value (see the section on profiles for details)
该属性给出了用于解析属性值的方案(scheme)的名字,请参阅profile部分以获得详细信息。
http-equiv = name [CI]
This attribute may be used in place of the name attribute. HTTP servers use this attribute to gather information for HTTP response message headers
该属性可以被用来顶替name属性。HTTP服务器使用该属性来搜集关于HTTP响应消息头信息。

Attributes defined elsewhere

在其他地方定义的属性

The META element can be used to identify properties of a document (e.g., author, expiration date, a list of key words, etc.) and assign values to those properties. This specification does not define a normative set of properties.

META元素可以用来标识一个文档的各种属性以及对这些属性进行赋值,例如:作者,过期日期,关键字列表等。本规范没有定义一个正式的属性集合。

Each META element specifies a property/value pair. The name attribute identifies the property and the content attribute specifies the property's value.

每一个META元素都包含一个属性/值对。name属性标识属性名字,content属性描述了改属性的取值。

For example, the following declaration sets a value for the Author property:

<META name="Author" content="Dave Raggett">

The lang attribute can be used with META to specify the language for the value of the content attribute. This enables speech synthesizers to apply language dependent pronunciation rules.

例如,下面的声明为Auhtor属性设置了一个值:

<META name="Author" content="Dave Raggett">
lang属性可以在META中使用,其作用是指定content属性的语言。这可以使语音合成器拥有根据语言应用发音规则的能力。

In this example, the author's name is declared to be French:

<META name="Author" lang="fr" content="Arnaud Le Hors">

下面的声明例子展示了将作者名字是用法语给出的:

<META name="Author" lang="fr" content="Arnaud Le Hors">

Note. The META element is a generic mechanism for specifying meta data. However, some HTML elements and attributes already handle certain pieces of meta data and may be used by authors instead of META to specify those pieces: the TITLE element, the ADDRESS element, the INS and DEL elements, the title attribute, and the cite attribute.

注释。META元素是指定元数据的一般机制。然而,一些HTML元素和属性已经处理了相当部分的元数据,并且作者可以使用这些元素和属性代替META来指定这些元数据。它们包括:TITLE元素,ADDRESS元素,INS及DEL元素,title属性以及cite属性。

Note. When a property specified by a META element takes a value that is a URI, some authors prefer to specify the meta data via the LINK element. Thus, the following meta data declaration:

<META name="DC.identifier"
      content="http://www.ietf.org/rfc/rfc1866.txt">

might also be written:

<LINK rel="DC.identifier"
         type="text/plain"
         href="http://www.ietf.org/rfc/rfc1866.txt">

注释。当一个META元素所定义的属性携带一个URI值时,一些作者更喜欢采用LINK元素来描述元数据。于是,下面的元数据声明:

<META name="DC.identifier"       content="http://www.ietf.org/rfc/rfc1866.txt"> 

可以被写成:

<LINK rel="DC.identifier"          type="text/plain"          href="http://www.ietf.org/rfc/rfc1866.txt">

META and HTTP headers
META元素和HTTP头

The http-equiv attribute can be used in place of the name attribute and has a special significance when documents are retrieved via the Hypertext Transfer Protocol (HTTP). HTTP servers may use the property name specified by the http-equiv attribute to create an [RFC822]-style header in the HTTP response. Please see the HTTP specification ([RFC2616]) for details on valid HTTP headers.

当文档是通过超文本传输协议(HTTP)进行获取时,http-equiv属性可以被用来代替name属性,并且这样做有特殊的好处。HTTP服务器可以使用http-equiv属性所指定的属性名在HTTP响应中创建一个RFC822形式的HTTP头。

The following sample META declaration:

<META http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT">

will result in the HTTP header:

Expires: Tue, 20 Aug 1996 14:25:27 GMT

This can be used by caches to determine when to fetch a fresh copy of the associated document.

下面的META声明样例:

<META http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT">

将会在HTTP头中形成如下文本:

Expires: Tue, 20 Aug 1996 14:25:27 GMT 

它可以被缓存用来决定何时去获取相关文档的新拷贝。

Note. Some user agents support the use of META to refresh the current page after a specified number of seconds, with the option of replacing it by a different URI. Authors should not use this technique to forward users to different pages, as this makes the page inaccessible to some users. Instead, automatic page forwarding should be done using server-side redirects.

注释。一些用户代理支持META的下列用法:在指定数量的秒数之后用一个不同的URI来刷新当前页面。作者不应使用该项技术进行不同页面的跳转,因为它会使页面对某些用户不可访问。自动页面跳转的正确做法应该是使用服务器端的重定向。

META and search engines
META元素和搜索引擎

A common use for META is to specify keywords that a search engine may use to improve the quality of search results. When several META elements provide language-dependent information about a document, search engines may filter on the lang attribute to display search results using the language preferences of the user. 

META的一种常见的用法是指定关键字,这些关键字可以使搜索引擎改善检索结果的质量。当关于一个文档的多个语言相关的META元素被提供时,搜索引擎可以在lang属性上做相应过滤来显示符合用户喜好的指定语言的检索结果。

For example,

例如:

<-- For speakers of US English --> 
<META name="keywords" lang="en-us"           content="vacation, Greece, sunshine">
 <-- For speakers of British English --> 
<META name="keywords" lang="en"           content="holiday, Greece, sunshine">
 <-- For speakers of French -->
 <META name="keywords" lang="fr"           content="vacances, Gr&egrave;ce, soleil">

The effectiveness of search engines can also be increased by using the LINK element to specify links to translations of the document in other languages, links to versions of the document in other media (e.g., PDF), and, when the document is part of a collection, links to an appropriate starting point for browsing the collection.

搜索引擎的有效性也可以通过使用LINK元素来提升。这些LINK元素可以用来链接文档其他语言的翻译版本,其他介质版本(例如:PDF)以及在文档是集合的一部分时,链接到浏览整个集合合适的起始点。

Further help is provided in the section on helping search engines index your Web site.

帮助搜索引擎索引你的网站部分提供了更进一步的帮助。

META and PICS
META和PICS

The Platform for Internet Content Selection (PICS, specified in [PICS] ) is an infrastructure for associating labels (meta data) with Internet content. Originally designed to help parents and teachers control what children can access on the Internet, it also facilitates other uses for labels, including code signing, privacy, and intellectual property rights management.

互联网内容选择平台(PICS)是一个将label(元数据)与Internet内容关联的框架体系。最开始它是被设计成帮助父母和老师控制儿童可以访问Inernet的资源,同时它也提供label的其他用途,包括代码签名,隐私以及知识产权管理。

This example illustrates how one can use a META declaration to include a PICS 1.1 label:

下面的例子展示了如何使用META声明来包含PICS 1.1 label:

<HEAD>
 
<META http-equiv="PICS-Label" 
content='
 (PICS-1.1 "http://www.gcf.org/v2.5"
    labels on "1994.11.05T08:15-0500"
      until "1995.12.31T23:59-0000"
      for "http://w3.org/PICS/Overview.html"
    ratings (suds 0.5 density 0 color/hue 1))
 '>


  <TITLE>
... document title ...
</TITLE> </HEAD>
META and default information
META和缺省信息

The META element may be used to specify the default information for a document in the following instances:

META元素可以被用来指定文档的下列缺省信息:

  • 缺省的Script脚本语言
  • 缺省的样式表语言
  • 文档字符编码

 

The following example specifies the character encoding for a document as being ISO-8859-5

下面的例子为文档指定了缺省的字符编码机制ISO-8859-5

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-5">

Meta data profiles
元数据profile(肖像)

The profile attribute of the HEAD specifies the location of a meta data profile. The value of the profile attribute is a URI. User agents may use this URI in two ways:

HEAD元素的profile属性指定了一个元数据profile的地址。profile属性的值是一个URI。用户代理可以用如下两种方式来使用此URI:
  • As a globally unique name. User agents may be able to recognize the name (without actually retrieving the profile) and perform some activity based on known conventions for that profile. For instance, search engines could provide an interface for searching through catalogs of HTML documents, where these documents all use the same profile for representing catalog entries
  • 作为全局唯一名字。用户代理可能不用真正检索相应的profile,就有能力识别出这个名字,并且可以基于对这个profile已知的一些约定来实施一些 动作。举个例子,在所有文档都使用了同样的profile来表示分类实体时,搜索引擎可以提供有一个在HTML文档的分类内进行搜索的接口,
  • As a link. User agents may dereference the URI and perform some activity based on the actual definitions within the profile (e.g., authorize the usage of the profile within the current HTML document). This specification does not define formats for profiles.
  • 作为连接。用户代理可以解除URI引用然后基于其在profile内的实际定义执行一些动作。例如,允许在当前文档内使用profile。本规范没有定义profile的格式。

This example refers to a hypothetical profile that defines useful properties for document indexing. The properties defined by this profile -- including "author", "copyright", "keywords", and "date" -- have their values set by subsequent META declarations.

下面的例子引用到一个假定的profile,该profile定义了很多对文档索引有用的属性:它们包括 "author", "copyright", "keywords", and "date"。这些属性的值通过一系列META声明来设置。

 <HEAD profile="http://www.acme.com/profiles/core"> 
  <TITLE>How to complete Memorandum cover sheets</TITLE>
 <META name="author" content="John Doe">
 <META name="copyright" content="&copy; 1997 Acme Corp.">
 <META name="keywords" content="corporate,guidelines,cataloging">
 <META name="date" content="1994-11-06T08:49:37+00:00"> 
 </HEAD> 

As this specification is being written, it is common practice to use the date formats described in [RFC2616], section 3.3. As these formats are relatively hard to process, we recommend that authors use the [ISO8601] date format. For more information, see the sections on the INS and DEL elements.

当本规范正在撰写时,使用在[RFC2616]3.3部分中描述的日期格式是一种业内通用的做法。由于这些格式相对来说比较难处理,我们建议作者使用[ISO8601]的日期格式。请参看INS和DEL元素的相关部分以获取更多信息。

The scheme attribute allows authors to provide user agents more context for the correct interpretation of meta data. At times, such additional information may be critical, as when meta data may be specified in different formats. For example, an author might specify a date in the (ambiguous) format "10-9-97"; does this mean 9 October 1997 or 10 September 1997? The scheme attribute value "Month-Day-Year" would disambiguate this date value.

scheme 属性允许作者向用户代理提供关于如何正确解析元数据的更多上下文环境。当元数据可能用不同的格式进行指定时,这样的附加信息可能是必须的。例如作者可能用 “10-9-97”这种二义性的格式里表示一个日期,该日期是表示1997年10月9日还是表示1997年9月10日?如果将scheme属性值设置为 “Month-Day-Year”就可以解除这个日期值的二义性。

At other times, the scheme attribute may provide helpful but non-critical information to user agents.

在另外的一些时候,schema属性可以想用户代理提供虽然不是关键的但很有用的信息。

 

For example, the following scheme declaration may help a user agent determine that the value of the "identifier" property is an ISBN code number:

<META scheme="ISBN"  name="identifier" content="0-8230-2355-9">

Values for the scheme attribute depend on the property name and the associated profile.

例如,下面的scheme声明可以帮助用户代理判定"identifier"属性是一个ISBN编码数字:

<META scheme="ISBN"  name="identifier" content="0-8230-2355-9">

scheme属性的取值依赖于属性名及其相关联的profile。

Note. One sample profile is the Dublin Core (see [DCORE]). This profile defines a set of recommended properties for electronic bibliographic descriptions, and is intended to promote interoperability among disparate description models.

注释。一个profile实际例子是Dublin Core。该profile定义了一组建议用于电子数目表述的属性。该profile试图为该领域内不同描述模型提供互操作能力。