? Success

User tests: Successful: Unsuccessful:

avatar compojoom
compojoom
10 Jun 2015

…ut the same tags twice

In lib_compojoom we have few layouts for social share:
https://github.com/compojoom/lib_compojoom/tree/master/source/libraries/compojoom/layouts/social/share

I've implemented the open graph requirements to properly share an item in the facebook layout:
https://github.com/compojoom/lib_compojoom/blob/master/source/libraries/compojoom/layouts/social/share/facebook.php

And I was about the to do the same for the gplus layout as one could use the layouts separately. Google plus is reading open graph data, so basically I could output the same stuff on the page.

Due to my use of $document->addCustomTag whenever I call

$document->addCustomTag('<meta property="og:url" content="' . JURI::current() . '" />');
$document->addCustomTag('<meta property="og:url" content="' . JURI::current() . '" />');

This would be added to the head twice. Which I think is not necessary. At the end we don't see the same behavior when we use JHtml::script or stylesheet? That's why I've changed the
fetchHead function to just output unique values from the custom array:
https://github.com/joomla/joomla-cms/compare/staging...compojoom:addCustomTag?expand=1#diff-ed74c9a4d3ec7e43b62b75c502e3787dL241

How to test?
Let's take a component view. for example:
\components\com_content\views\article\tmpl\default.php right after the defined call add:

$document = JFactory::getDocument();
$document->addCustomTag('<meta property="og:url" content="' . JURI::current() . '" />');
$document->addCustomTag('<meta property="og:url" content="' . JURI::current() . '" />');

without the patch this should output the og:url meta property twice in the head (in single view of article). With the patch you should see the og:url tag just once.

avatar compojoom compojoom - open - 10 Jun 2015
avatar zero-24 zero-24 - change - 10 Jun 2015
Category Libraries
avatar zero-24 zero-24 - change - 10 Jun 2015
Status New Pending
avatar zero-24 zero-24 - change - 12 Jun 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 12 Jun 2015
Labels Added: ?
avatar anibalsanchez
anibalsanchez - comment - 13 Jun 2015

#test works as expected. No duplicated tags.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7147.

avatar anibalsanchez anibalsanchez - test_item - 13 Jun 2015 - Tested successfully
avatar dgt41
dgt41 - comment - 13 Jun 2015

@test OK Nice one!

avatar jwaisner
jwaisner - comment - 15 Jun 2015

@test

Works as intended.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7147.

avatar jwaisner jwaisner - test_item - 15 Jun 2015 - Tested successfully
avatar zero-24 zero-24 - alter_testresult - 16 Jun 2015 - dgt41: Tested successfully
avatar zero-24 zero-24 - change - 16 Jun 2015
Status Pending Ready to Commit
avatar zero-24
zero-24 - comment - 16 Jun 2015

RTC Thanks :smile:


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7147.

avatar zero-24 zero-24 - change - 16 Jun 2015
Labels Added: ?
avatar yvesh
yvesh - comment - 26 Jun 2015

@test Works

avatar zero-24 zero-24 - change - 2 Jul 2015
Milestone Added:
avatar zero-24 zero-24 - change - 2 Jul 2015
Milestone Added:
avatar zero-24 zero-24 - close - 11 Jul 2015
avatar mbabker mbabker - close - 11 Jul 2015
avatar mbabker mbabker - reference | 4991abe - 11 Jul 15
avatar mbabker mbabker - merge - 11 Jul 2015
avatar mbabker mbabker - change - 11 Jul 2015
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2015-07-11 14:54:09
Closed_By mbabker
avatar mbabker mbabker - close - 11 Jul 2015
avatar zero-24 zero-24 - change - 14 Oct 2015
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment