Phoca Open Graph - meta property instead meta name

Phoca plugins - support for all Phoca plugins except Phoca Gallery plugins
lukasz
Phoca Member
Phoca Member
Posts: 13
Joined: 14 Feb 2013, 17:24

Phoca Open Graph - meta property instead meta name

Post by lukasz »

Hello,

now Phoca Open Graph adds tags like this:

Code: Select all

<meta name="og:title" content="Test"/>
This is not entirely correct. Validator w3.org treats it as an error:
Bad value og:title for attribute name on element meta: Keyword og:title is not registered.
To check it yourself, you can type this code to validator:

Code: Select all

<!DOCTYPE html><head><meta name="og:title" content="Test"/><title>Test</title></head>
Facebook recommend to use the meta property, too.

I suggest you change the meta name to meta property like this:

Code: Select all

<meta property="og:title" content="Test"/>
Thank you for looking at the issue.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Open Graph - meta property instead meta name

Post by Jan »

Hi, see similar posts in this forum, Phoca Open Graph module does not decide which form will be used, all this depends on Joomla! and its methods:

Code: Select all

$document->setMetadata('og:title', htmlspecialchars($thisTitle));
So this is more a question on Joomla! developers :idea: but not sure if it is good to limit your site and decrease your website SEO because of some rules which do not reflect newest features of browsers and different web services :idea:

Jan
If you find Phoca extensions useful, please support the project
lukasz
Phoca Member
Phoca Member
Posts: 13
Joined: 14 Feb 2013, 17:24

Re: Phoca Open Graph - meta property instead meta name

Post by lukasz »

Alternatively, you can try JDocumentHTML/addCustomTag, although I do not know if it will be a good idea...

http://forum.joomla.org/viewtopic.php?f=712&t=786152
http://api.joomla.org/cms-3/classes/JDocumentHTML.html
http://docs.joomla.org/JDocumentHTML/addCustomTag
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Open Graph - meta property instead meta name

Post by Jan »

Hi, thank you for the info, added to feature request list.

Jan
If you find Phoca extensions useful, please support the project
baschwar
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 07 Nov 2014, 18:31

Re: Phoca Open Graph - meta property instead meta name

Post by baschwar »

Any updates on this issue? Without correcting this issue it makes this plugin useless.
:cry: :cry: :cry:
Jan wrote:Hi, thank you for the info, added to feature request list.

Jan
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Open Graph - meta property instead meta name

Post by Jan »

Hi, sorry I don't understand, validator outputs do not have any influence on functionality of the site. Sometimes, following the validator rules you can limit your site and your SEO (as validators do not accept specific browsers features and new features, so when you will limit your site, your SEO will decrease :idea: - of course I don't say, that you should break standard html or css rules - see more information about this in similar posts in this forum )

Anyway, did you ask on joomla.org forum or Joomla! developers why the use "name" instead of "property" and if they will change it?

It is still in features request list, so if there will be no changes in Joomla!, I will try to do it per some "specific/hack" solution but it is always better to make it proper way, because making non standard method can be a problem in feature :-( :-(

Jan
If you find Phoca extensions useful, please support the project
Hayward
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 10 Jun 2015, 00:36

Re: Phoca Open Graph - meta property instead meta name

Post by Hayward »

Joomla's $document->setMetadata is working as intended - it is for <meta name="something" />

You have to use $document->addCustomTag to use the proper <meta property="something" /> for the Open Graph meta.

Example:

For og:title, find this (in /plugins/content/phocaopengraph/phocaopengraph.php):

Code: Select all

$document->setMetadata('og:type', $this->params->get('type'.$suffix, 'article'));
and replace it with this:

Code: Select all

$document->addCustomTag('<meta property="og:type" content="' . ($this->params->get('type'.$suffix, 'article')) . '" />');
You need to replace all the setMetadata with addCustomTag for anything that uses meta property instead of meta name (full list here).
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Open Graph - meta property instead meta name

Post by Jan »

Hi, of course, you need not to use Joomla! setMetadata but you need not to to use addCustomTag either and you can write it directly to template more easier way, the problem of addCustomTag is you need to write in fact whole complicated code so maybe then it is more easier to write it directly to template code.

But anyway thank you for the info, it can be set as alternative - did you test that it is set to right place in html source code?



Jan
If you find Phoca extensions useful, please support the project
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Open Graph - meta property instead meta name

Post by Jan »

If you find Phoca extensions useful, please support the project
Post Reply