This module seems to contain some w3c validation errors and warnings (HTML5) that should be resolved. At this moment, inclusion of the metatag module leads to the following html validation errors:
- Error:: Attribute “xmlns:article” not allowed here.
- Info: Attribute with the local name “xmlns:article” is not serializable as XML 1.0.
This error and warning are repeated fivefold for the following attribute values: article, book, product, profile, and video.
These, in turn, appear to be defined in the metatag.module file:
// Namespaces for OpenGraph.
$namespaces['xmlns:article'] = "http://ogp.me/ns/article#";
$namespaces['xmlns:book'] = "http://ogp.me/ns/book#";
$namespaces['xmlns:product'] = "http://ogp.me/ns/product#";
$namespaces['xmlns:profile'] = "http://ogp.me/ns/profile#";
$namespaces['xmlns:video'] = "http://ogp.me/ns/video#";
Thanks,
LaravZ
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | metatag-w3c_validation-2753595-10.patch | 1011 bytes | sinn |
| #4 | w3c_validation_error_on-2753595-4.patch | 3.54 KB | sylus |
Comments
Comment #2
jalpesh commentedAny hint, how to solve this?
Comment #3
laravz commentedI've found the following discussion.
Apparently, "the only long-term solution is that Facebook needs to create an alternate syntax that is valid HTML5."
However, it could also potentially be solved like this:
For HTML5, add this to your html element like described on ogp.me and keep your og: prefixed property's:
Not sure whether this is what you're looking for though.
Comment #4
sylus commentedI believe this logic is in the metatag_opengraph submodule in 7.x-1.x so was thinking we could do the same thing for the 8.x-1.x series making this optional for the time being?
Attaching a patch :)
Comment #5
sylus commentedComment #6
jalpesh commentedI don't know that is right solution or not but by applying path it solve all w3c error . Thanks.
Comment #8
damienmckennaCommitted. Thanks!
Comment #10
sinn commentedSolution from #4 doesn't help pass validation. There are errors:
But with solution #3 validation is passed.
Comment #11
mfrosch commented@sinn your patch #10 resolved the w3c issues for me - thanks.
Comment #12
damienmckennaHuh, nice improved syntax. Lets see what the testbot says.
Comment #13
damienmckennaSorry to throw this at the issue, but I want to a) find documentation that clarifies this is the correct approach to take, b) write a test to confirm the output works as intended.
Comment #14
thejimbirch commentedThe patch in #10 applies correctly and pages now validate.
Documentation:
On http://ogp.me/#metadata, the basic example shows the og: prefix getting set.
<html prefix="og: http://ogp.me/ns#">Subsequent sections specify the namespace:
music - Namespace URI: http://ogp.me/ns/music#
video - Namespace URI: http://ogp.me/ns/video#
article - Namespace URI: http://ogp.me/ns/article#
book - Namespace URI: http://ogp.me/ns/book#
profile - Namespace URI: http://ogp.me/ns/profile#
website - Namespace URI: http://ogp.me/ns/website#
This blog has a deeper explanation:
https://www.niallkennedy.com/blog/2012/01/open-graph-protocol.html
Tests
Can you point out a test that would have similar functionality that could be used as an example?
Comment #15
karens commentedFollowing this because these elements also invalidate Google AMP pages. I believe the alternate format would pass AMP validation.
Comment #16
zanonmark commentedPatch #10 works for me, too.
Please merge it in the official branch.
Thanks,
MZ
Comment #17
dinesh18 commented#10 looks good to me. +1 to RTBC
Comment #18
chris2k commentedPatch #10 works for me too. +1 to RTBC
Comment #19
suraj2012 commentedpatch #10 works for me too.
Comment #20
Marishka_ commented+1 for Patch #10. Please merge.
Comment #21
damienmckennaFine fine fine :)
Committed.
I've spun off the tests into a new issue: #2992352: Add test coverage for custom HTML from
Comment #23
damienmckennaComment #24
damienmckennaComment #25
damienmckennaComment #26
damienmckennaFYI I opened a new issue for the D7 branch to backport this: #2994102: W3C validation error on xmlns attribute (D7)