クリエイティブ・コモンズ・ライセンスのメタデータをHTML5に合わせる
クリエイティブ・コモンズ・ライセンスのメタデータをW3C Markup Validatorに掛けるとエラーが出た。調べてみると,こちら:Valid HTML5 + RDFa 1.1 code for the chooser output に対処法が載っていた。
これに拠れば,ライセンスを選ぶときに生成されたコードはHTML5に準じておらず,そのコードをHTML5に合わせるには下の Original code example→Modified code のように書きかえると良いそうだ。Changes made に変更箇所が纏められており,それに添って変えるところをハイライトしてみた。
Original code example:
<a rel= "license" href= "http://creativecommons.org/licenses/by/3.0/deed.en_US"><img alt= "Creative Commons License" style= "border-width: 0" src= "http://i.creativecommons.org/l/by/3.0/88x31.png" /></a><br /><span xmlns: dct= "http://purl.org/dc/terms/" property= "dct: title">My Blog Post</span>
by <a xmlns: cc= "http://creativecommons.org/ns#" href= "http://example.com/my-blog-post/" property= "cc: attributionName" rel= "cc: attributionURL">John Smith</a> is
licensed under a <a rel= "license" href= "http://creativecommons.org/licenses/by/3.0/deed.en_US">Creative Commons Attribution 3.0 Unported License</a>.Modified code:
<a rel= "license" href= "http://creativecommons.org/licenses/by/3.0/deed.en_US"><img alt= "Creative Commons License" style= "border-width: 0" src= "http://i.creativecommons.org/l/by/3.0/88x31.png" /></a><br /><span property= "dc: title">My Blog Post</span>
by <a href= "http://example.com/my-blog-post/" property= "cc: attributionURL"><span property= "cc: attributionName">John Smith</span></a> is
licensed under a <a rel= "license" href= "http://creativecommons.org/licenses/by/3.0/deed.en_US">Creative Commons Attribution 3.0 Unported License</a>.Changes made:
a) removedxmlns: *
attributes
b)property= "dct: title"
->property= "dc: title"
as per http://www.w3.org/2011/rdfa-context/rdfa-1.1
c) changed the "attribute work"<a>
tag and replacedrel= "..."
withproperty= "..."
and inserted inside it a child<span property= "cc: attributionName">
. This is done so that we can remove the rel and now it can be validated correctly.
注記:表記を所々変えて引用している (URL中のコロンを全角にする等)。