grails <meta name="layout" ... w3c html5 [invalid] Markup validation - validation

When I check the html 5 Markup Validation Service I don't want to get these errors anymore:
Error Line 159, Column 51: Attribute name not allowed on element meta at this point.
<meta name="layout" content="main_profil"/>
Error Line 159, Column 51: Element meta is missing required attribute itemprop.
<meta name="layout" content="main_profil"/>
Is there anyway to solve this? I need this meta tag on top of the gsp to say which Layout will be used.

The error messages you are getting indicate that you have the <meta> element in the <body> section of your page, when it should be in the <head> section.
However, "layout" is not a valid name for the <meta> element in HTML5, so you're not going to be able to stop the validator from reporting an error for that.
You could try registering the "layout" name on the WHATWG wiki but it will take some time for the validator to catch up with that.

Related

W3C validation - end tag for "meta" omitted, but OMITTAG NO was specified

I am getting an error as shown below
Error Line 6, Column 467: end tag for "meta" omitted, but OMITTAG NO was specified
…ta,Manufacturing_Industrial,Educational_Training,Teacher,Engineering_Projects">
✉
You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
How can I solve this ?
Please see the source code of the page below
<!doctype html>
<html>
<head>
<title>Jobslamp-free online resume creation and sharing,fresher jobs,experienced jobs,India jobs,Kerala jobs</title>
<meta name="keywords" content="Karnataka,Bangalore_Rural,Healthcare,Office_Assistant,Kerala,Ernakulam,IT_Hardware_Networking,Engineer,Sales___Marketing,Executive,Maharashtra,Mumbai_City,Retailing,Manager,Kollam,CRM_CallCentres_BPO_ITES_Med.Trans,Customer_Care,Hotel_Travel_Tourism_Airlines_Hospitality,Front_Office_Staff,Andhra_Pradesh,Hyderabad,IT_Software,Java_Developer,Pathanamthitta,Manufacturing_Industrial,Educational_Training,Teacher,Engineering_Projects">
<meta name="description" content="The best job oriented resume sharing system. Create and Publish your online resumes for FREE. Search and apply your dream jobs for FREE. Post your jobs for FREE.">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
Thanks in advance
The error message points out the solution: replace the ending > with />.
<meta name="keywords" content="all your keywords" />
You'll need to fix the other meta tags the same way.

W3C Validation error: there is no attribute X

I edit the post, and for many changes i have 1error : there is no attribute X
You have used the attribute named above in your document, but the
document type you are using does not support that attribute for this
element. This error is often caused by incorrect use of the "Strict"
document type with a document that uses frames (e.g. you must use the
"Transitional" document type to get the "target" attribute), or by
using vendor proprietary extensions such as "marginheight" (this is
usually fixed by using CSS to achieve the desired effect instead).
This error may also result if the element itself is not supported in
the document type you are using, as an undefined element will have no
supported attributes; in this case, see the element-undefined error
message for further information.
How to fix: check the spelling and case of the element and attribute,
(Remember XHTML is all lower-case) and/or check that they are both
allowed in the chosen document type, and/or use CSS instead of this
attribute. If you received this error when using the element
to incorporate flash media in a Web page, see the FAQ item on valid
flash.
Line 71, column 16: there is no attribute "property"
<meta property='og:locale' content='en_US'/>
How can i fix this?
Thanks in advanced.
1 Update:
I replace the
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
with :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
The error didn't any more, but i have any other errors.
2 update
i replace in the header.php the
<meta http-equiv="content-language" content="en_US" />
to:
<meta http-equiv="content-language" content="en_us" />
The second thing that i have done:
In the opengraph.php (Yoast plugin) i replace the:
if ( $echo )
echo "<meta property='og:locale' content='" . esc_attr( $locale ) . "'/>\n";
else
return $locale;
to:
if ( $echo )
echo "<meta property='og:locale' content='en_us'/>\n";
else
return $locale;
But the result is the same. 1 error.
The <meta> tag doesn't have an attribute called "property". You appear to be validating Open Graph protocol tags using the W3C's HTML validator. This is pretty much guaranteed not to work. It might be advantageous to look at Facebook's debugger tool. It should provide feedback on OG markup.

Validating custom tumblr theme

I am witing a custom tumblr theme. When I went to validate it using the W3C validator I got a bucket full of errors from the code tumblr inserts into the blog outside of my theme code. So I did troubleshooting 101 and installed their default theme and tried to validate it. I used the Redux theme. When I put it into the validator I get these 3 errors:
Line 2, Column 871: Stray doctype.
….0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Error Line 3, Column 67: Stray end tag html.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
Error Line 3, Column 67: Cannot recover after last error. Any further errors will be ignored.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
so my question, how critical is validation? The problem I'm trying to solve is that my custom theme is quite sluggish. I figured step 1 to speed it up would be use valid markup. But that does not seem possible. (Also getting buckets of errors from the FB G+ and TW button code that I have no control over). thanks in advance.
I believe the problem with trying to validate a Tumblr theme is that there is specific code that Tumblr recognises, and needs, that an HTML validator will count as invalid. Although it is used in Tumblr, it is technically not correct as just html.
Code for blog posts such as
{block:Label}
may be flagged as invalid as the HTML validator doesn't know that it as correctly structured code for Tumblr. The validator may say that it is invalid when placed in a certain context such as in 'li' elements even though for Tumblr this is where it is meant to be placed.
Try using this validator as you can group errors by type, that way you can see if you have errors other than ones created by using Tumblr code.
http://validator.keegan.st/
Solve all the html errors and don't worry about the tumblr caused ones.

Microdata itemprop causes W3C validator error

After adding Microdata to my pages, I got many errors from W3C validator complaining the itemprop:
there is no attribute "itemprop"
From code like this:
<p itemprop="description">...</p>
This is my DOCTYPE and html tag
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="http://www.facebook.com/2008/fbml">
How to fix the validator errors?
p.s. Previously I have the validator error for itemscope as well. But after I changed it to itemscope="itemscope" then the error is fixed.
Documents with HTML 5 plus Microdata used to validate successfully but because of Bug #14020 the validator has become more strict on declaring documents as "valid". Your document is valid HTML 5 + Microdata, but is not strictly an HTML 5-only document.
You can use http://Validator.nu/ to validate HTML 5 + Microdata.
The site linked to in Fabian's answer is not the W3C site he mentions, so I wouldn't trust that as much for HTML 5 as I might have for earlier (pre-2000) versions of HTML.
The reason you had to change itemscope to itemscope="itemscope" is that previous browsers and specifications have defined incompatible interpretations (sometimes true, sometimes false) of code such as itemscope (no value), itemscope="" (an empty string is interpreted as false by XPath) and itemscope="false" (any non-empty string sometimes interpreted as true). Thus the statement in the spec that "The values 'true' and 'false' are not allowed on boolean attributes." However, "true" and "false" can appear in certain attribute values because they are allowed on enumerated attributes such as draggable. See bullet #4 regarding coding boolean values.
The workarounds (elsewhere) to insert invalid code with scripting may hide that code from the validator, but it won't create a document that is any more valid than using static HTML code because the HTML 5 specification is defined in terms of the internal document model, not the external representation. See HTML 5 Specifications focus on the DOM.
OK, here is what I did to make this work with the Validator:
Referring to this page: http://www.w3.org/TR/2011/WD-microdata-20110525/
I enclosed the main in my page (the "wrapper" if you will) with the following:
<div id="layout" itemscope>
If you have itemscope in the div tag for your page or for the div containing microdata, then the W3C Validtor will like it just fine.
The DOCTYPE needs to be HTML5 for microdata to validate.
<!DOCTYPE html>
<html xmlns:fb="http://www.facebook.com/2008/fbml">
.....
It will work with paragraph tag:
http://www.w3.org/TR/2011/WD-microdata-20110525/
if you just want to remove this tag you can do so by removing tag from file which is located in main root folder
"wp-includes/general-template.php" at 891 line
you can just remove extra tag.

Is it valid to give a style element an ID?

It says here that it is not within HTML4, though I don't really see where that's spelled out in the text.
From what I can tell, based on this, it is ok to do so in HTML5 but I'm not entirely sure (assuming style is an HTML element?)
I am using this to rotate out a stylesheet and want it to be as valid as possible according to HTML5 specs, so wondering if I should rewrite it with a data-* element.
+1 Interesting question!
Instead of using a style block, you should consider linking (link) to your stylesheets and then switch them out by referencing an id or a class.
That said, title is perfectly acceptable for a style tag in HTML5. You can use this as a hook for your stylesheet switching.
http://www.w3.org/TR/html5/semantics.html#the-style-element
Fyi... this validates
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<style title="whatever"></style>
</head>
<body>
Test body
</body>
</html>
http://validator.w3.org/#validate_by_input+with_options
I've just put the following code into the W3C validator and it has no errors :)
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<style id="test"></style>
</head>
<body>
Test body
</body>
</html>
I think the W3C Validator is a good resource for this type of thing, it is marked as experimental but that's because the standard is yet to be be finalised.
It is not valid in HTML4 (as per the spec) and data-* attributes are not either. That is, the document will not validate against the Doctype spec if you use these attributes.
Regardless of whether the document validates or not, browsers will ignore elements that they do not recognize.
Style tags are DOM elements like any other tag, so you can add any attributes you want.

Resources