I am looking into various open source CMS/blogging/forum products: (Joomla, Drupal, Textpattern, Wordpress, punBB/fluxBB, phpBB, SMF etc). I am a fledgling "standardista" and 100% standards compliant code (XHTML 1.0 Strict) will be a requirement for all my new websites. One of the first things I do when visiting a website for a web product I am considering for use (to get a "first impression" indication of the product's quality), is to run their home page through the W3C validator (http://validator.w3.org/). And frankly, I am not impressed with many of these projects, and Drupal is currently no exception. But Drupal is certainly not alone. As of July 31, 2008 the following home pages all failed:

http://drupal.org/ - XHTML 1.0 Transitional - 43 Errors
http://www.simplemachines.org/ - XHTML 1.0 Transitional - 11 Errors
http://www.joomla.org/ - XHTML 1.0 Transitional - 10 errors
http://punbb.informer.com/ - XHTML 1.0 Strict - 2 Errors
http://textpattern.com/ - XHTML 1.0 Transitional - 1 error

But these home pages all passed...
http://www.phpbb.com/ - XHTML 1.0 Strict - Passed validation
http://wordpress.org/ - XHTML 1.0 Transitional - Passed validation
http://fluxbb.org/ - XHTML 1.0 Strict - Passed validation

Now I realize that 99% of the sites out in the wild fail validation, but a home site for a project whose purpose in life is to actually generate web page content and whose goal is to promote "the semantic web" (i.e. Drupal), would do well to set an example for the world by paying better attention to the details of its own home flagship web site.

When I made a post similar to this over at the ExpressionEngine site a year or so ago, I was initially greeted with responses like: "Passing validation doesn't matter" and "Shut up you code Nazi!". However, I did notice that a week or so later, their home page was cleaned up and passed validation. I know that my view on this matter is far from universal, but if it matters to me, it probably matters to a few others too. Creating valid web markup is just not that hard! And not doing so is, (to me), an indication of ignorance, indifference or incompetence. I really appreciate those who *do* pay attention to the details. And you only get one chance to make a first impression!. Just sayin'...

Is it asking too much for a project web site to simply pass validation? (After all, XHTML is a flavor of XML, and XML served up as XML is required to be valid markup to even be displayed at all!)

Comments

yelvington’s picture

While you're busy validating, you might want to read the html

 <!-- Note: does not validate. We would like it to, but that would mean reduced user experience for the majority of our visitors. -->
ridgerunner’s picture

If you look at the details of the validation report, you will see that most of the errors in the markup have absolutely nothing to do with "reduced user experience" and everything to do with sloppy code. i.e. "required attribute not specified", "end tag omitted", "ID already defined", and a whole slew of errors (and warnings) that are simply due to unencoded ampersands (&).

xmacinfo’s picture

Well, Drupal can output valid code. It's the themer and site administrator choice to make sure that their Drupal sites validate.

I guess that the next redesign of the Drupal.org home page will probably validate. But it's not due for a long time.

With any web site, however, when publishing user-generated content to the home page you may easily get errors. It's not all users that are web standards savvy.

By the way, you don't need to serve XHTML as XML to validate.

ridgerunner’s picture

If you *do* serve XHTML as XML (as the good folks at the W3C would prefer us to do), then the XML parsers which read these true XML pages will refuse to display them because, by definition, "XML must be well formed".

Flying Drupalist’s picture

I don't see much value in your approach. Many of the themes in the downloads section validate, use one of them if the stock theme isn't to your taste.

I also don't see the connection between validation and 'the semantic web', it's fully possible to be semantic without validating and vice versa, and finally, while the semantic web's great, users should always come first.

ridgerunner’s picture

I just installed Drupal 6.3 on my localhost test system and at first initial glance I am very impressed. Small footprint, clear concise installation documentation and the first default home page validates as XHTML 1.0 Strict! I like that the root .htaccess appears to cover all the right security bases and the clean URLs work perfectly right out of the box.

Maybe my first impression based on the project home page being invalid is not representative of the project's true nature (i.e. Don't judge a book by its cover?)

Anyhoo... So far, so good!

jng12’s picture

from what i understand, drupal.org is still running 5.x (am I wrong on this one?) and drupal 6 is much much better on a whole bunch of stuff including standardization.

m4manas’s picture

I have used drupal 5.x and 6.x and it validates.
Check out http://www.taxlaw.co.in
It depends on the theme you are using as the core Drupal is seldom using an html tags.

http://m4manas.wordpress.com
http://www.taxlaw.co.in
http://www.caselaw.co.in

ridgerunner’s picture

Just looked at the markup of the new V6 Drupal.org main page. A comment on line 4 of the HTML still provides the following (lame) disclaimer:

<-- Note: does not validate. We would like it to, but that would mean reduced user experience for the majority of our visitors. -->

Yeah, the "user experience" will definitely be "reduced" for "the majority of our visitors" if the following validation errors were fixed:

  • unescaped '&'
  • missing 'alt' attribute in <img> tag
  • illegal 'alt' attribute in <a> tag
  • illegal <wbr /> tag

Come on guys, get with the program and make your site pass validation! (IMHO, if you are serving up the content with a DOCTYPE of XHTML, then validation should be a site requirement). Trying to excuse invalid code because of "reduced user experience" just does not fly. If you need to serve up some flash content with the <embed> tag, (which is invalid in XHTML), then you should be serving up the page DOCTYPE as transitional HTML, in which case the markup would still pass validation.

If it really is true (as the note on line 4 above states) that you "would like it to" validate, then just do it! Its not that hard! I was able to fix all the 42 markup errors on page 1 in less than 2 minutes. None of these errors had anything to do with "user experience", but had everything to do with sloppy coding.

ColdSun’s picture

If you need to serve up some flash content with the tag, (which is invalid in XHTML), then you should be serving up the page DOCTYPE as transitional HTML, in which case the markup would still pass validation.

Actually its quite easy to include flash in files and have it pass xhtml strict.

A working example is as follows:

		<div id="site-logo">
			<object type="application/x-shockwave-flash" data="../flash/live.swf" width="1006" height="162">
				<param name="movie" value="../flash/live.swf" />

				<param name="wmode" value="transparent" />
				<img src="../flash/live.gif" width="1006" height="162" alt="banner" />
			</object>
		</div>
jon nunan’s picture

The update isn't finished yet. Yes the code is running on drupal 6.x now, but there is a whole new theme coming for drupal.org.
http://drupal.markboultondesign.com/

ridolfidesigns’s picture

I create websites running drupal. I am a themer and not a programmer and the themes/websites validate fine until I start installing contributed modules. I don't know if the module developers don't care if the code generated validates or not. But I have submitted requests to let the offending modules know and how I fixed it with no responses. I have to admit it's a bit frustrated when I am anal about creating clean code that validates and I can't reach that goal. It almost makes me want to bail on drupal and move on to something else.

Please understand I am not talking about themes. I am talking about contrib modules that generate html that doesn't validate.

michelle’s picture

All HTML from modules (except for very tiny snippits, possibly) should be run through the theme function. Therefore it is all overrideable and you can change it yourself without hacking the module. Of course, filing issues to fix it at the source is beneficial but you aren't without recourse if the maintainer doesn't respond.

BTW, this topic is about drupal.org, not Drupal itself, so this is getting very OT.

Michelle

ridolfidesigns’s picture

I think you missed what the original post was saying. Yes, he brought up that drupal.org doesn't validate but his point was that if their "flagship" site doesn't validate, why would the CMS itself have code that validates?

So I said about how module developers don't consider or at least it seems like they don't consider outputting valid code.

I know about overriding theme functions, sometimes the module developers don't make it that easy for "non-programmers" such as myself.

Also, it gets to be a pain in the butt when you have your own code to think about let alone somebody else's code to worry about.

I don't understand a lot about module development, but why not do it right the first time? I understand there are bugs and whatever to work out but does that mean the module should produce code that doesn't validate?

michelle’s picture

Drupal.org doesn't validate because of a conscious decision to lose validation to gain something else. Drupal core validates. Contributed modules are always going to be hit and miss on code quality, including markup. They are contributed by users with varying degrees of experience, skill, and time to make it perfect.

If you don't want to have someone else's code to worry about, you can always write your own modules.

Michelle

ridolfidesigns’s picture

Drupal.org doesn't validate because of a conscious decision to lose validation to gain something else

Read above about this.

Good job, I am just asking. As I said before, I am not a programmer. I am not sure if you read that or not. I am learning, slowly but I am not there yet.

I think what is so silly is that I ask some questions (I have seen this before) right away module developers are, "why don't you write your own?" The thing is, programming is a bit harder to grasp than css or html. I am not sure why if a programmer can grasp whatever programming language, why they can't grasp valid HTML? I am simply trying to understand.

michelle’s picture

The answer "write your own" comes whenever someone complains that the module that they are getting for free doesn't do what they want. It's a pretty natural response. I suppose we could simply say "You're right, that sucks" and comiserate. Either way won't solve your problem. You want modules that validate. Currently there are modules that don't. The reason for that may be that the programmer doesn't know HTML, that they don't have time to work out markup issues, or that they just don't care. The reason is not that drupal.org does not validate. The problems are unrelated. If you file an issue and let them know about the problem, the problem will likely get fixed if it's the first one. If they already know but haven't fixed it, they will likely accept a patch that fixes the problem with minimal effort on their part. If they won't even accept a patch and don't have a good reason for it, it's probably a module you want to avoid anyway.

In all cases, posting a forum thread about the bluebeach theme not validating to complain that contributed modules aren't validating either doesn't solve anything except give you a chance to vent. If that's all you wanted, that's cool. But that won't fix the modules.

Michelle

frank0987’s picture

My Drupal 6.x site (using Garland): 1 error - XHTML Strict (Results)
Drupal.org: 70 errors - XHTML Transitional (Results)

Seems like Drupal.org needs a rewrite, or use the Garland theme instead.

Sorry for the duplicate comments

Flying Drupalist’s picture

d.o is currently undergoing a redesign. If this was an issue it would be 'fixed'.

frank0987’s picture

This page has also failed, even though most (if not all) users here posted VALID html.

ridgerunner’s picture

Here's an update of my original post. As of 2010-02-26 1:46 pm MST...

These failed:
http://drupal.org/ - XHTML 1.0 Transitional - 51 Errors, 42 warning(s)
http://punbb.informer.com/ - XHTML 1.0 Strict - 31 Errors, 1 warning(s)
http://modxcms.com/ - XHTML 1.0 Strict - 14 Errors

These passed:
http://textpattern.com/ - XHTML 1.0 Strict - Passed validation
http://www.phpbb.com/ - XHTML 1.0 Strict - Passed validation
http://fluxbb.org/ - XHTML 1.0 Strict - Passed validation
http://wordpress.org/ - XHTML 1.0 Transitional - Passed validation
http://www.joomla.org/ - XHTML 1.0 Transitional - Passed validation
http://www.simplemachines.org/ - XHTML 1.0 Transitional - Passed validation
http://expressionengine.com/ - XHTML 1.0 Transitional - Passed validation

Come on Drupal, get your act together!

Mario T’s picture

_

tsbah’s picture

We are in 2014. The W3C validation output for drupal.org is as follows: 3 errors + 1 (HTML5) warning:

  • Error Line 2, Column 92: When the attribute xml:lang in no namespace is specified, the element must also have the attribute lang present with the same value.
    http://www.w3.org/1999/xhtml" xml:lang="en" version="XHTML+RDFa 1.0" dir="ltr">
  • Error Line 2, Column 92: The version attribute on the html element is obsolete. You can safely omit it.
    http://www.w3.org/1999/xhtml" xml:lang="en" version="XHTML+RDFa 1.0" dir="ltr">
  • Error Line 3, Column 51: The profile attribute on the head element is obsolete. To declare which meta terms are used in the document, instead register the names as meta extensions. To trigger specific UA behaviors, use a link element instead.
jaypan’s picture

Last time I checked, the W3C validator wasn't set to handle HTML5 + RDFa validation, even though this combination is valid under the W3C specs. So it's possible that these errors are incorrect (I didn't specifically look into them to check).

Edit: here are a couple of links on the matter, though granted they are a little old:
http://www.phase2technology.com/blog/w3c-validation-for-drupal-7-html5-r...
http://answers.semanticweb.com/questions/9792/whats-the-status-of-valida...

Contact me to contract me for D7 -> D10/11 migrations.