血統の森+はてな

旧はてなダイアリーの自動インポートによるアーカイブです。

HTML5メモ(3) a要素・link要素のrel属性 の覚え書き

いきなり本題からずれるけど、HTML4では定義されていないrel属性値を指定するには、

一般に、メタデータの指定には次の2つの手法が取られる。

  1. プロパティとその値を宣言する。これには2通りのやり方がある。
    1. 文書中での、META要素による宣言。
    2. 文書外のメタデータへLINK要素でリンクする(リンク形式の項を参照のこと)。
  2. プロパティとその正当な値を定義しているプロファイルを参照する。 プロファイルを指し示すのには、HEAD要素の profile属性を用いる。

プロファイルがHEAD要素について設定されるため、ここに含まれるすべてのMETA要素及びLINK要素において同じプロファイルが適用されるという点に注意されたい。

ユーザエージェントは、メタデータ機構のサポートは要求されない。メタデータをサポートしようとするユーザエージェントに対して、本仕様はメタデータをどう解釈すべきかを定義しない。

とある。

ちなみにHTML5ではhead要素のprofile属性は削除される方向。

13.2 Non-conforming features
Elements in the following list are entirely obsolete, and must not be used by authors:

profile on head elements
When used for declaring which meta terms are used in the document, unnecessary; omit it altogether, and register the names.
When used for triggering specific user agent behaviors: use a link element instead.

とまあ、meta要素-link要素で持って行くのを主流にしていくのかな、など。
HTML5 Profilesで、グローバル属性として定義されていることが考えられている模様。id:vantguardeさん*1thx!


仕様で定義されるrel属性の属性値は次の通り。

6.12 リンク形式 -HTML4 Basic HTML data types (ja)
http://www.asahi-net.or.jp/~sd5a-ucd/rec-html401j/types.html#type-links
4.12 Links ? HTML5 (including next generation additions still in development)
http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#linkTypes

HTML5ではその他の属性値については、今のところ「誰でも」「予備登録できる」状態にある。

Extensions to the predefined set of link types may be registered in the WHATWG Wiki RelExtensions page. [WHATWGWIKI*2]

Anyone is free to edit the WHATWG Wiki RelExtensions page at any time to add a type.

なので、どんな属性値が指定できるのかはここではいちいち取り上げないことにする。取り得る属性値についてはexisting-rel-values ・ Microformats Wikiにまとめのような形であるけれど、ぶっちゃけいろんな状態のものが多すぎる。


ちなみにHTML5にはコメントアウトの形で何らかの方法による使用頻度の調査結果が載せられているので、ここに記しておく。

<link rel>での上位2つはstylesheet,alternateとのこと。前者はスタイルシートなので、みんな使ってるだろう。後者は代替スタイルシートが以外と?使われていると言うことだろうか。

:stylesheet -- most commonly used <link rel> value, variants came in 7th, 8th, 12th, 17th...
:alternate -- second most used <link rel> value
:icon -- link rel="shortcut icon" and its ilk are the fourth, sixth, and ninth most used values
:external -- fifth and sixth most used <a rel> value (sixth is "external nofollow")
:license -- seventh most used <a rel> value

<link rel><a rel>での上位2つはnofollow,tagとのこと。これはソーシャルブックマークでの使用頻度が多いからか。

:nofollow -- most used <a rel> value (and sixth most used is "external nofollow")
:tag -- second and third most used <a rel> value (third is technically "category tag").
:bookmark -- fourth most used <a rel> value

その他のコメントもあわせて。

:index -- used more than "top" and "contents" on <link> (though on <a>, "contents" wins)
:prev -- prev is used more than previous
:search -- used quite a bit
:sidebar -- used quite a bit