LoginSignup
25

More than 5 years have passed since last update.

posted at

updated at

【OGP】prefix?xmlns?どっちを入れればいいのか。

OGPの設定の際に

prefixもxmlnsも入れてくださいという紹介の仕方をされているサイトを最初に見てしまって、混乱してしまいました。それ以降もprefixが書いてあったり、xmlnsが書いてあったり・・・いったいどっちなんだろうと。

prefix
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#">
xmlns
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://ogp.me/ns/fb#" lang="ja">

気持ち悪かったのでぐぐってみたところ。

結論

xmlnsはXML用!
prefixはhtml5用!
prefixを使おう!でした。

そもそもOGP本家には、prefixの記載しかなかったです。

どこからxmlnsがわいてきたのだろう。

参考サイト

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
25