meta要素に関する仕様

そういや真面目にmeta要素の仕様を読んだことなかったので、調べてみました。

meta 要素

お馴染みこんなやつです。

<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
<meta name="csrf-param" content="authenticity_token">

4.2 Document metadata — HTML5 に定義が書かれています。適当に訳すと...

The meta element represents various kinds of metadata that cannot be expressed using the title, base, link, style, and script elements.

title, base, link, style, script 要素では表現できないメタデータを表現するための要素です。

The meta element can represent document-level metadata with the name attribute, pragma directives with the http-equiv attribute, and the file's character encoding declaration when an HTML document is serialized to string form (e.g. for transmission over the network or for disk storage) with the charset attribute.

name属性でドキュメントレベルのメタデータを、http-quiv属性でプラグマディレクティブを、charset属性で文字エンコーディング宣言を表現します。

name 属性

4.2 Document metadata — HTML5

If a meta element has a name attribute, it sets document metadata. Document metadata is expressed in terms of name-value pairs, the name attribute on the meta element giving the name, and the content attribute on the same element giving the value.

もしmeta要素がname属性を持つならば、meta要素はドキュメントメタデータを設定します。ドキュメントメタデータは name-value として表現され、name属性は名前を、content属性は値を示します。

Standard metadata names

4.2 Document metadata — HTML5

  • application-name
  • author
  • description
  • generator
  • keywords

Other metadata names

MetaExtensions - WHATWG Wiki を見るのがよいとのこと。 twitter:site, csrf-token など様々なものが定義されています。