Page 1 of 1

Getting Open Graph plugin to work with external URLs

Posted: 21 Jan 2016, 23:59
by njbair
On our site, we serve all our images via Amazon S3, including featured article images. The Phoca OG plugin was automatically adding the http:// etc to those URLs, causing them to break. I was able to fix it by modifying the plugin to check the URLs for an existing scheme and only attaching the base URL if not present.

I would love to contribute this code back to the project, if there's a place where I can do that. Thanks!

Re: Getting Open Graph plugin to work with external URLs

Posted: 27 Jan 2016, 01:38
by Jan
Hi, thank you for the info, yes, will be great, you can paste the changes here in the forum, so I can then implement it in the next version.

Thank you, Jan

Re: Getting Open Graph plugin to work with external URLs

Posted: 03 Jul 2016, 09:22
by fynhooft
Hello,

Same problem for me.
Where is the patch ?

Re: Getting Open Graph plugin to work with external URLs

Posted: 05 Jul 2016, 11:29
by Jan
Hi, there is no answer from the users, so I don't know.

Which version of the Open Graph do you use? If you use version 3.0.5, try to modify this line:

cca 193

FROM:

Code: Select all

plgContentPhocaOpenGraphHelper::renderTag('og:image', JURI::base(false).$src[1], $type); 
TO:

Code: Select all

$absU = 0;
                // Test if this link is absolute http:// then do not change it
                $pos1             = strpos($src[1], 'http://');
                if ($pos1 === false) {
                } else {
                    $absU = 1;
                }
                
                // Test if this link is absolute https:// then do not change it
                $pos2             = strpos($src[1], 'https://');
                if ($pos2 === false) {
                } else {
                    $absU = 1;
                }
                
                if ($absU == 1) {
                    $linkImg = $src[1];
                } else {
                    $linkImg = JURI::base(false).$src[1];
                }
                
                plgContentPhocaOpenGraphHelper::renderTag('og:image', $linkImg, $type);
And let me know it this work.

Thank you, Jan

Re: Getting Open Graph plugin to work with external URLs

Posted: 05 Jul 2016, 12:45
by fynhooft
Hello,

Thank you.
I have changed in http://www.gimpons.net. You can look in the differents pages.
It seems to work but no "og:image" in the first page : why ?

Re: Getting Open Graph plugin to work with external URLs

Posted: 05 Jul 2016, 15:30
by Jan
Is the first page "com_content" - article?

Phoca Open Graph plugin works only in articles, If you need to display the meta tags on other parts of the site, try to use:

https://www.phoca.cz/phoca-open-graph-system-plugin

Jan