$document->setMetaData creates duplicate meta data tags

This forum is for reporting bugs in Joomla!. Please don't report problems with extensions in here.
Locked
User avatar
hotnuts21
Joomla! Explorer
Joomla! Explorer
Posts: 315
Joined: Wed Aug 17, 2005 11:11 pm

$document->setMetaData creates duplicate meta data tags

Post by hotnuts21 » Tue Aug 05, 2008 1:50 pm

I have found that when using setMetadata to alter the meta tags of a custom component, then it creates 2 instances of the actual meta tag. This is true for most but not all tags. I have tried with default meta tag field empty and still the same result.

Here are the tags and what happens

Code: Select all

$document->setMetadata('Description', $this->image->title); //-results in two meta description tags the new one and the default
$document->setMetadata('Generator', 'generator tag test'); //- results in two meta generator tags the new one and the default joomla one
$document->setMetadata('Keywords', 'Keywords'); // - results in two meta keywords tags, the new one and the default joomla

$document->setMetadata('robots', 'robots');   //- Replaces robots tag as it should
$mainframe->setPageTitle($this->image->title); //- creates custom title as it should
 

User avatar
rayge
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 177
Joined: Tue Nov 06, 2007 6:26 pm

Re: $document->setMetaData creates duplicate meta data tags

Post by rayge » Wed Aug 06, 2008 9:11 pm

Hmm yeah I see that too. Hopefully someone can tell us what to modify to fix that. looks like the function is in libraries/joomla/document/document.php
http://www.casualgamesource.com Over 1000 FREE pc and mac casual games!
http://www.thedecoratinglady.com Decorating articles for every room in your home!

User avatar
hotnuts21
Joomla! Explorer
Joomla! Explorer
Posts: 315
Joined: Wed Aug 17, 2005 11:11 pm

Re: $document->setMetaData creates duplicate meta data tags

Post by hotnuts21 » Wed Aug 06, 2008 10:07 pm

Shall I post this as a proper bug in the bug tracker?

User avatar
rayge
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 177
Joined: Tue Nov 06, 2007 6:26 pm

Re: $document->setMetaData creates duplicate meta data tags

Post by rayge » Wed Aug 06, 2008 10:24 pm

THat is A GREAT IDEA. Yes Id say go for it!
http://www.casualgamesource.com Over 1000 FREE pc and mac casual games!
http://www.thedecoratinglady.com Decorating articles for every room in your home!

User avatar
hotnuts21
Joomla! Explorer
Joomla! Explorer
Posts: 315
Joined: Wed Aug 17, 2005 11:11 pm

Re: $document->setMetaData creates duplicate meta data tags

Post by hotnuts21 » Wed Aug 06, 2008 11:02 pm


User avatar
rayge
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 177
Joined: Tue Nov 06, 2007 6:26 pm

Re: $document->setMetaData creates duplicate meta data tags

Post by rayge » Wed Aug 06, 2008 11:22 pm

Kewl!

Im gonna assume that it builds out an array rather than a string thats why its not replacing the variables.
http://www.casualgamesource.com Over 1000 FREE pc and mac casual games!
http://www.thedecoratinglady.com Decorating articles for every room in your home!

User avatar
mmaison
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Fri Mar 23, 2007 5:24 pm
Location: United Kingdom
Contact:

Re: $document->setMetaData creates duplicate meta data tags

Post by mmaison » Fri Aug 08, 2008 8:51 pm

Please see my answers on the tracker.

I'm not sure why at the moment this is done this way but I'll find out !

User avatar
ircmaxell
Joomla! Ace
Joomla! Ace
Posts: 1926
Joined: Thu Nov 10, 2005 3:10 am
Location: New Jersey, USA
Contact:

Re: $document->setMetaData creates duplicate meta data tags

Post by ircmaxell » Sat Aug 09, 2008 3:50 am

Basically, the third paramter (http_equiv) controls which array is used. Look at the method on line 396 of /libraries/joomla/document/document.php This controls whether or not the first variable passed to it is the name, or the http-equiv value..

For example:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, follow" />
<meta name="keywords" content="..." />
<meta name="description" content="..." />
<meta name="generator" content="Joomla! 1.5 - Open Source Content Management" />
Anthony Ferrara - Core Team - Development Coordinator - Bug Squad - JSST

http://moovum.com/ - The Bird is in the air! Get Mollom Anti-Spam on your Joomla! website with Moovur...
http://www.joomlaperformance.com For All Your Joomla Performance Needs

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: $document->setMetaData creates duplicate meta data tags

Post by AmyStephen » Sun Aug 24, 2008 11:08 pm

Hotnuts21 and rayge -

I was looking at Mickael's patch, trying to figure out how I could validate it, as a tester, and discovered this thread was documented in the report.

Would the two of you please download and apply this patch and see if it fixes the problem you have identified? Also, please note your testing results in the report.

Thanks, Mickael, for the fix and, in advance, to the two of you for testing it.

Amy

User avatar
hotnuts21
Joomla! Explorer
Joomla! Explorer
Posts: 315
Joined: Wed Aug 17, 2005 11:11 pm

Re: $document->setMetaData creates duplicate meta data tags

Post by hotnuts21 » Mon Aug 25, 2008 8:29 pm

I will be able to test this week and provide feedback.

Sorry for the delay
Paul

Natasha111
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Mon Apr 28, 2008 10:44 am

Re: $document->setMetaData creates duplicate meta data tags

Post by Natasha111 » Thu Sep 18, 2008 11:52 am

I am having the same problem and for this site http://www.dominguezpublicidad.com, I'm having 7 duplicated meta descriptions . I come out on the first and second page of Google for some keywords and don't want to be penalized,


how do I fix this? Was this patch successfully tested ? I have no idea how to implement it.

Thank you.


Natalia

User avatar
hotnuts21
Joomla! Explorer
Joomla! Explorer
Posts: 315
Joined: Wed Aug 17, 2005 11:11 pm

Re: $document->setMetaData creates duplicate meta data tags

Post by hotnuts21 » Thu Sep 18, 2008 7:16 pm

If you follow the links to the tracker you can see it was succesfully tested before I had a chance to post my own results.

From what I can see it has been committed to 1.5.7 because the bug appears to be gone in the latest version!!

User avatar
mmaison
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Fri Mar 23, 2007 5:24 pm
Location: United Kingdom
Contact:

Re: $document->setMetaData creates duplicate meta data tags

Post by mmaison » Fri Sep 19, 2008 10:17 am

You're right, the patch has been included in the latest version.
Now setMetaData is flexible on the case. If you first set a meta "Keywords", you can change it using "keywords", it won't create 2 instances.
Then setMetaData is now able to call directly "setGenerator" or "setDescription" is you pass to it "generator" or "description".

Mickael

MGLorencin
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Fri Sep 07, 2007 2:38 pm

Re: $document->setMetaData creates duplicate meta data tags

Post by MGLorencin » Wed Sep 24, 2008 2:52 pm

hotnuts21 wrote:If you follow the links to the tracker you can see it was succesfully tested before I had a chance to post my own results.

From what I can see it has been committed to 1.5.7 because the bug appears to be gone in the latest version!!
Well I am on 1.5.7 and the bug is not gone in latest version, I have duplicate meta in all (but only in) articles, but not in front page, section or category view.

I even tried and run over with complete J1.5.7 and it didn's solve my issue until I installed SEO patch for 1.5.7 from joomlatwork.com ...really glad this solved it :)

User avatar
C0nw0nk
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 248
Joined: Tue Jun 15, 2010 1:12 am
Location: United Kingdom, London
Contact:

Re: $document->setMetaData creates duplicate meta data tags

Post by C0nw0nk » Sun Nov 11, 2012 1:34 am

Thanks for the information been searching everywhere for this can someone list it on the wiki also does this work with the latest version of joomla ?


Locked

Return to “Joomla! 1.5 Bug Reporting”