About Me
- Unknown
copyright 2011 EM Squared, Inc, all rights reserved. Powered by Blogger.
Monday, April 2, 2012
Joomla "rights" Meta Tag Fails W3 Validation
So, you've built a new HTML5 Joomla website and you're ready to deliver it to your client. But first, because you're a quality conscious developer, you mosey on over to the W3 Validator to check it one last time. And... what's this!?? You have an ERROR! A meta tag with the name of "rights" is not a valid meta tag. You'd never add this tag - where is it coming from??
Since Joomla 1.5, Joomla developers have reported that Joomla renders the meta tag, <meta name="rights" content="your text here">, that the W3 Validator fails to validate. As near as I can tell, this issue has been closed by the Joomla team: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=26069
However, now as of Joomla 2.5 it's still not fixed. Not really. The "fix" requires that you leave the "Content Rights" field blank in the Joomla Global Configuration page. That's not a fix - it's a hack. There is no indication on the Global Configuration page that putting text here will produce an invalid meta tag. And why have the field at all if it's main function is to produce the meta tag? This field should still be used - it's useful info for your site and your theme - but it should NOT render an invalid meta tag. Period.
You could just tell your clients not to put any text in that field. But that's not very professional (it's what the Joomla team did). Or, you can add this code to your template to prevent the meta from rendering:
That removes the offending met tag from the list of meta tags to be rendered.
Since Joomla 1.5, Joomla developers have reported that Joomla renders the meta tag, <meta name="rights" content="your text here">, that the W3 Validator fails to validate. As near as I can tell, this issue has been closed by the Joomla team: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=26069
However, now as of Joomla 2.5 it's still not fixed. Not really. The "fix" requires that you leave the "Content Rights" field blank in the Joomla Global Configuration page. That's not a fix - it's a hack. There is no indication on the Global Configuration page that putting text here will produce an invalid meta tag. And why have the field at all if it's main function is to produce the meta tag? This field should still be used - it's useful info for your site and your theme - but it should NOT render an invalid meta tag. Period.
Here's how to fix it yourself
Until the Joomla team decides to address this easy-to-fix issue head on, there is something you can do.You could just tell your clients not to put any text in that field. But that's not very professional (it's what the Joomla team did). Or, you can add this code to your template to prevent the meta from rendering:
$doc =& JFactory::getDocument();
unset($doc->_metaTags["standard"]["rights"]);That removes the offending met tag from the list of meta tags to be rendered.
While you're at it...
As long as you're messing with meta tags, you can also add your own tags$doc->_metaTags["standard"]["geo.region"] = "US-GA";
$doc->_metaTags["standard"]["geo.placename"] = "Atlanta";Final Note...
This meta fix can easily be made into a plugin. You might try this yourself - it would be a great "starter" if you've never written a plugin before but want to learn how. If you need help with the plugin, feel free to contact me.
Subscribe to:
Posts (Atom)
Blog Archive
About EM Squared
We develop custom softare in C#, Java, PHP, and Python, and we build websites using Joomla, Wordpress, and Drupal.
Find out more about EM Squared