Hi, Aryeh,
Sorry for late reply.
I think I can not enable the $wgAllowMicrodataAttributes setting in LocalSettings.php, because my project hosted in Chinese Wikipedia, I think I have to wait for the decision from Foundation. For now, I will custom data-* for a temporary solution.
Thanks for your help.
Regards, Mingli
On Fri, Mar 11, 2011 at 10:11 AM, Aryeh Gregor Simetrical+wikilist@gmail.com wrote:
On Thu, Mar 10, 2011 at 6:04 AM, Mingli Yuan mingli.yuan@gmail.com wrote:
I am trying to make a wiki template to render some meta data of an article. And I want to use HTML5 Microdata to make these metadate machine-readable.
But the problem I found is that XHtml Sanitizer in MediaWiki remove all the attributes needed.
Set $wgAllowMicrodataAttributes = true; in LocalSettings.php. This is false by default (along with $wgAllowRdfaAttributes) because there's a political battle between microdata and RDFa and it's much too early to see who will win, and we wound up deciding not to take a side. Personally I think microdata is superior and we should support it and not RDFa, but others disagreed. (FWIW, I think our RDFa support doesn't actually work correctly anyway, but I can't remember the details and could be wrong.)
Glancing back over the microdata code, I should point out an important caveat: we don't allow any itemtypes other than the three originally defined in the microdata specification. This seems kind of stupid, though, so on reflection, I removed it in r83689. You can copy the (quite trivial) patch to your own wiki if you want:
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83689
The Microdata spec[1] add below global attribute for almost every html tag:
- itemscope
- itemtype
- itemid
- itemref
- itemprop
Every, not almost every -- they're global attributes.
But for the meta tag, I am not very sure, I don't know whether the search engine still use it or not. If the search engines do not care about it, why not relax the constraints on it?
We could allow meta tags and just not whitelist the properties like name or http-equiv. That would probably be safe. But you should only use <meta> with microdata if you can't avoid it, anyway.
On Thu, Mar 10, 2011 at 12:16 PM, Krinkle krinklemail@gmail.com wrote:
I dont know how final the HTML5 microdata spec is though (it seems to be marked as a draft) perhaps we should wait adding new attirbutes untill it's ready ?
All of HTML5 is only a draft, by W3C standards. The WHATWG version is billed as a "Living Standard" like all the rest: http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#microdata. Microdata specifically is stable -- it hasn't changed for quite a few months, and the editor has assured me that it's very unlikely to change incompatibly at this point. The question is really whether we want to take sides in the microdata vs. RDFa battle. (As I said, I think we should, but I'm probably biased.)