Joomla meta tags do not pass validation in HTML 5

General questions relating to Joomla! 2.5. Note: All 1.6 and 1.7 releases have reached end of life and should be updated to 2.5. There are other boards for more specific help on Joomla! features and extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Locked
jayflux
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 110
Joined: Sun Jul 25, 2010 3:02 pm

Joomla meta tags do not pass validation in HTML 5

Post by jayflux » Thu Jun 02, 2011 11:12 pm

Testing Joomla 1.6.3 in html 5 the follow does not validate.

Bad value rights for attribute name on element meta: Keyword rights is not registered.
<meta name="rights" content="" />

Bad value language for attribute name on element meta: Keyword language is not registered.
<meta name="language" content="en-GB" />

Bad value language for attribute name on element meta: Keyword language is not registered.
<meta name="title" content="" />

Can we do something about these? Maybe remove them or think of another way to include them, im not sure if search engines even use any of these tags. The language meta tag is very pointless considering you add the language as an attribute in the <html> element. Example... <html lang="en-GB">

Considering HTML5 will soon be the norm (and already is for some) it should be something we deal with now.

jayflux
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 110
Joined: Sun Jul 25, 2010 3:02 pm

Re: Joomla meta tags do not pass validation in HTML 5

Post by jayflux » Mon Jun 06, 2011 11:37 am

Bump

jayflux
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 110
Joined: Sun Jul 25, 2010 3:02 pm

Re: Joomla meta tags do not pass validation in HTML 5

Post by jayflux » Mon Jun 06, 2011 9:07 pm

I have now added this problem to the tracker, some of these tags are not needed and should be removed.

http://joomlacode.org/gf/project/joomla ... m_id=26069

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 36587
Joined: Sat Apr 05, 2008 9:58 pm

Re: Joomla meta tags do not pass validation in HTML 5

Post by Webdongle » Mon Jun 06, 2011 9:22 pm

What Template were you using when you validated ?

I have tried with Beez2 and phoca_t
FULL SUCCESS
with both
Screenshot-456.png
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

User avatar
Geoff Rantala
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Mon Apr 18, 2011 7:13 am
Location: Alameda, California, US
Contact:

Re: Joomla meta tags do not pass validation in HTML 5

Post by Geoff Rantala » Mon Jun 06, 2011 9:37 pm

Webdongle wrote:What Template were you using when you validated ?

I have tried with Beez2 and phoca_t
FULL SUCCESS
with both
Screenshot-456.png
I'm going to guess he's talking about "Beez5" in HTML5 mode (or possibly another HTML5 Doctype-based template).

Am having the same issue where the "rights" and "language" meta tag name keywords are "not registered", and therefore show up as invalid errors. I even looked in "head.php" to see if there was a way to comment those two out (like the "generator" meta tag), but those weren't as easily found.

Anyone know of a way to disable these two meta tags? (Even if a core-hack, as undesirable as that is.)


BTW- Thanks jayflux for bringing this up and adding to the tracker... was searching out a solution to this today myself.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 36587
Joined: Sat Apr 05, 2008 9:58 pm

Re: Joomla meta tags do not pass validation in HTML 5

Post by Webdongle » Mon Jun 06, 2011 10:03 pm

Ah
I get two that way

<meta name="rights" content="" />
and
<meta name="language" content="en-GB" />

looks like "language" has been depreciated ?
http://www.w3.org/TR/2011/WD-html-marku ... guage.html

Am trying to find a definitive list of meta names
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

jayflux
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 110
Joined: Sun Jul 25, 2010 3:02 pm

Re: Joomla meta tags do not pass validation in HTML 5

Post by jayflux » Tue Jun 07, 2011 7:41 am

Reading the tracker replies they are not going to bother fixing it because HTML 5 is still i experimental mode.
Ok fair enough but take these stupid meta tags out, nobody uses them and they are there purely for SEO which is stupid.

A: because it breaks validation (I've never even heard of rights and language meta tags before)

B: because nobody knows if these tags make any effect whats so ever, so its pointless rushing to put this in the core

C: not everybody cares about SEO enough to break their validation so i don't see why these meta tags are compulsory, they should be optional in the back end.

D: The language of your website is already defined in the html lang attribute so I don't know why Joomla is defining it again with the language tag, makes NO sense what so ever. Ive been googling these meta tags and I come up with barely anything.

If you wish to take these out go into Includes -> application.php and look for where it adds them (i think its line 174 & 175) then comment these 2 lines out
@webdongle

Your screenshot quite clearly says XHTML 1.0 not HTML 5, im talking about templates with the <!doctype html> at the top.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 36587
Joined: Sat Apr 05, 2008 9:58 pm

Re: Joomla meta tags do not pass validation in HTML 5

Post by Webdongle » Tue Jun 07, 2011 1:07 pm

jayflux wrote:....
@webdongle

Your screenshot quite clearly says XHTML 1.0 not HTML 5, im talking about templates with the <!doctype html> at the top.
And you never made an error yourself at all ? :laugh:

On a positive note, is it more Template related than Joomla related ? A more accurately written Template will not have that problem ?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

jayflux
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 110
Joined: Sun Jul 25, 2010 3:02 pm

Re: Joomla meta tags do not pass validation in HTML 5

Post by jayflux » Tue Jun 07, 2011 7:45 pm

Webdongle wrote:
jayflux wrote:....
@webdongle

Your screenshot quite clearly says XHTML 1.0 not HTML 5, im talking about templates with the <!doctype html> at the top.
And you never made an error yourself at all ? :laugh:

On a positive note, is it more Template related than Joomla related ? A more accurately written Template will not have that problem ?
No its Joomla related, having an xhtml 1.0 doctype in your template and calling it HTML 5 doesn't make it HTML 5 im afraid.

The meta tags that joomla spit out are deprecated after XHTML 1.0 meaning they're obsolete in the new doctype which is why the validation errors. Old templates will be fine but anyone moving over to html 5 will have this issue.

My overall point was these meta tags are pointless anyway regardless what doctype you're using, they should either be made optional or taken out.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 36587
Joined: Sat Apr 05, 2008 9:58 pm

Re: Joomla meta tags do not pass validation in HTML 5

Post by Webdongle » Wed Jun 08, 2011 1:28 am

jayflux wrote:.....

No its Joomla related, having an xhtml 1.0 doctype in your template and calling it HTML 5 doesn't make it HTML 5 im afraid.

The meta tags that joomla spit out are deprecated after XHTML 1.0 meaning they're obsolete in the new doctype which is why the validation errors. Old templates will be fine but anyone moving over to html 5 will have this issue.
...
So the metatags are created by Joomla and not by the Template ? Me thinks it is a Template issue because ....Although the metatags in Joomla could be more 'sympathetic' to html5 or perhaps a separate 'head include' for each doctype ... The Template can be written differently.
  1. By including creating their own metatags for the php IF statement for html5 being selected. And placing the '<jdoc:include type="head" />' code in the php IF for when html5 is not selected.

    or
  2. By not including the '<jdoc:include type="head" />' code at all and create their own metatags for each part of the php IF statements.

    or
  3. By not including the '<jdoc:include type="head" />' code at all and creating the Template for one particular doctype

The '<jdoc:include type="head" />' is an optional feature and therefore not a bug.

The usefulness(or not) of the metatags is a separate issue and off topic.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

TGHI
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Jun 30, 2011 1:06 pm

Re: Joomla meta tags do not pass validation in HTML 5

Post by TGHI » Thu Jun 30, 2011 1:19 pm

I had the same problem actually, but removing <jdoc:include type="head" /> was out of the question. Unfortunately the only way I could find to remove it was by editing a core file.

In /libraries/joomla/document/html/renderer/head.php on line 60

Code: Select all

	
            foreach ($document->_metaTags as $type => $tag)
		{
			foreach ($tag as $name => $content)
			
			{
				if ($type == 'http-equiv') {
					$content.= '; charset=' . $document->getCharset();
					$buffer .= $tab.'<meta http-equiv="'.$name.'" content="'.htmlspecialchars($content).'"'.$tagEnd.$lnEnd;
				}
				else if ($type == 'standard') {
					$buffer .= $tab.'<meta name="'.$name.'" content="'.htmlspecialchars($content).'"'.$tagEnd.$lnEnd;
				}
			}
		}

This is the output for all of the meta tags. I added this:

Code: Select all

		foreach ($document->_metaTags as $type => $tag)
		{
			foreach ($tag as $name => $content)
			
			{
				if ($type == 'http-equiv') {
					$content.= '; charset=' . $document->getCharset();
					$buffer .= $tab.'<meta http-equiv="'.$name.'" content="'.htmlspecialchars($content).'"'.$tagEnd.$lnEnd;
				}
				else if ($type == 'standard') {
					if ($name == "rights"  || $name == "language" || $name == "title"){
						continue;
					}else{
					$buffer .= $tab.'<meta name="'.$name.'" content="'.htmlspecialchars($content).'"'.$tagEnd.$lnEnd;
					}
				}
			}
		}
Which checks for the tags that break validation (and frankly don't do a whole lot of anything) and skips to the begining of the loop if found.


Hope that helps!

jayflux
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 110
Joined: Sun Jul 25, 2010 3:02 pm

Re: Joomla meta tags do not pass validation in HTML 5

Post by jayflux » Thu Jun 30, 2011 1:42 pm

Webdongle wrote:
jayflux wrote:
The '<jdoc:include type="head" />' is an optional feature and therefore not a bug.

The usefulness(or not) of the metatags is a separate issue and off topic.
what?

Thats the most ridiculous thing I've ever heard.
so because there's 1 or 2 meta tags which are old and invalidate the site I should abandon the whole joomla header? Talk about throwing the baby out with the bathwater.

How on earth would my titles work for starters?

As for 'its not a bug' well it obviously is as its in the tracker and those meta tags have been removed since I have posted this. Try looking at the tracker: http://joomlacode.org/gf/project/joomla ... m_id=26069

They were useless and served no purpose.

@TGHI

Good work but you didnt need to do that

go into Includes -> application.php and look for where it adds them (i think its line 174 & 175) then comment these 2 lines out

Code: Select all

$document->setMetaData('rights', $this->getCfg('MetaRights'));
$document->setMetaData('language', $lang_code);
Anyway this issue has been patched and should be fixed for 1.7 :D

realityking
Joomla! Explorer
Joomla! Explorer
Posts: 428
Joined: Fri May 21, 2010 11:43 am
Location: Aachen, Germany
Contact:

Re: Joomla meta tags do not pass validation in HTML 5

Post by realityking » Thu Jun 30, 2011 2:48 pm

jayflux wrote: The meta tags that joomla spit out are deprecated after XHTML 1.0 meaning they're obsolete in the new doctype which is why the validation errors. Old templates will be fine but anyone moving over to html 5 will have this issue.
Actually they aren't deprecated HTML4 (and thus XHTML1) just didn't define what vales the meta element's attributes take.
jayflux wrote:My overall point was these meta tags are pointless anyway regardless what doctype you're using, they should either be made optional or taken out.
We did some work on this for Joomla 1.7. For one all empty meta elements with an empty content attribute aren't displayed anymore, saving you on <meta name="rights"> if you don't enter anything. Also <meta name="title"> and <meta name="language"> have been removed.

jayflux
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 110
Joined: Sun Jul 25, 2010 3:02 pm

Re: Joomla meta tags do not pass validation in HTML 5

Post by jayflux » Thu Jun 30, 2011 3:17 pm

realityking wrote:
Actually they aren't deprecated HTML4 (and thus XHTML1) just didn't define what vales the meta element's attributes take.
Therefore they should never have been added in the first place.

TGHI
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Jun 30, 2011 1:06 pm

Re: Joomla meta tags do not pass validation in HTML 5

Post by TGHI » Thu Jun 30, 2011 4:34 pm

@TGHI

Good work but you didnt need to do that

go into Includes -> application.php and look for where it adds them (i think its line 174 & 175) then comment these 2 lines out

Code: Select all

$document->setMetaData('rights', $this->getCfg('MetaRights'));
$document->setMetaData('language', $lang_code);

Even better solution, thanks!

ssaudio
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Thu Jun 18, 2009 11:45 pm

Re: Joomla meta tags do not pass validation in HTML 5

Post by ssaudio » Fri Aug 05, 2011 8:51 pm

TGHI wrote:I had the same problem actually, but removing <jdoc:include type="head" /> was out of the question. Unfortunately the only way I could find to remove it was by editing a core file.

In /libraries/joomla/document/html/renderer/head.php on line 60

Code: Select all

	
            foreach ($document->_metaTags as $type => $tag)
		{
			foreach ($tag as $name => $content)
			
			{
				if ($type == 'http-equiv') {
					$content.= '; charset=' . $document->getCharset();
					$buffer .= $tab.'<meta http-equiv="'.$name.'" content="'.htmlspecialchars($content).'"'.$tagEnd.$lnEnd;
				}
				else if ($type == 'standard') {
					$buffer .= $tab.'<meta name="'.$name.'" content="'.htmlspecialchars($content).'"'.$tagEnd.$lnEnd;
				}
			}
		}

This is the output for all of the meta tags. I added this:

Code: Select all

		foreach ($document->_metaTags as $type => $tag)
		{
			foreach ($tag as $name => $content)
			
			{
				if ($type == 'http-equiv') {
					$content.= '; charset=' . $document->getCharset();
					$buffer .= $tab.'<meta http-equiv="'.$name.'" content="'.htmlspecialchars($content).'"'.$tagEnd.$lnEnd;
				}
				else if ($type == 'standard') {
					if ($name == "rights"  || $name == "language" || $name == "title"){
						continue;
					}else{
					$buffer .= $tab.'<meta name="'.$name.'" content="'.htmlspecialchars($content).'"'.$tagEnd.$lnEnd;
					}
				}
			}
		}
Which checks for the tags that break validation (and frankly don't do a whole lot of anything) and skips to the begining of the loop if found.


Hope that helps!
This worked perfect! Thanks!


Locked

Return to “General Questions/New to Joomla! 2.5”