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!
Getting Open Graph plugin to work with external URLs
-
- Phoca Newbie
- Posts: 1
- Joined: 21 Jan 2016, 23:53
- Jan
- Phoca Hero
- Posts: 48610
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Getting Open Graph plugin to work with external URLs
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
Thank you, Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 3
- Joined: 02 Jul 2016, 10:59
Re: Getting Open Graph plugin to work with external URLs
Hello,
Same problem for me.
Where is the patch ?
Same problem for me.
Where is the patch ?
- Jan
- Phoca Hero
- Posts: 48610
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Getting Open Graph plugin to work with external URLs
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:
TO:
And let me know it this work.
Thank you, Jan
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);
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);
Thank you, Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 3
- Joined: 02 Jul 2016, 10:59
Re: Getting Open Graph plugin to work with external URLs
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 ?
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 ?
- Jan
- Phoca Hero
- Posts: 48610
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Getting Open Graph plugin to work with external URLs
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
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
If you find Phoca extensions useful, please support the project