Page 1 of 2

Phoca Open Graph Titles

Posted: 05 Oct 2013, 11:18
by micherts
The plugin uses the menu title as the og:title but Joomla allows for this title to be changed either by entering 'Browser Page Title' in Page Display Options or by selecting 'Use site name in page titles' from Global Configuration. Neither of these options are picked up by Phoca OG - would it be possible to incorporate these features?

Thanks for your help.

Re: Phoca Open Graph Titles

Posted: 05 Oct 2013, 13:14
by Jan
Hi, not sure if I understand correctly what exactly is missing?

First the title is set by item:

Code: Select all

$thisTitle	= $row->title;
If it is the category view, then from category:

Code: Select all

if (isset($cItem[0]->title) && $cItem[0]->title != '') {
					$thisTitle		= $cItem[0]->title;
				}
In case it it set in parameters:

Code: Select all

// Title
		if ($this->params->get('title'.$suffix, '') != '') {
			$document->setMetadata('og:title', htmlspecialchars($this->params->get('title'.$suffix, '')));
		} else if ($row->title != '') {
			$document->setMetadata('og:title', htmlspecialchars($thisTitle));
		}
Means: if it set in parameters set the title by parameters, if not set the title by item or category (parameters value itself decides it if is taken from global configuration or parameters menu link :idea: )

The same with site name:

Code: Select all

// Site Name
		if ($this->params->get('site_name'.$suffix, '') != '') {
			$document->setMetadata('og:site_name', htmlspecialchars($this->params->get('site_name'.$suffix, '')));
		} else if ($thisTitle != '') {
			$document->setMetadata('og:site_name', htmlspecialchars($config->get('sitename')));
		}

Re: Phoca Open Graph Titles

Posted: 07 Oct 2013, 11:40
by micherts
Hi Jan,
Thanks for your detailed response. Unfortunately, I don't fully grasp your code as I'm not an expert. It sounds like you have it covered but I'm not experiencing the desired outcome. Let me explain further in layman's terms.
I have a page whose menu item title is 'Monitoring' and the site name is 'Camplex'. In Global Configuration the setting 'Include Site Name in Page Titles' is set to 'After'. Hence if you examine the HTML Source the title of the page is entered as <title>Monitoring - Camplex</title>. However, the OG title is entered as <meta property="og:title" content="Monitoring" />. I want the OG tag to match the Title tag.
If it helps, I can provide you a link and login for the site, as it's currently offline for construction.
Thanks for your help,
Michael

Re: Phoca Open Graph Titles

Posted: 10 Oct 2013, 00:22
by Jan
Hi, not sure which version you are running, maybe some old which does not have such feature?

Re: Phoca Open Graph Titles

Posted: 10 Oct 2013, 06:45
by micherts
I'm running Joomla! 3.1.5, Phoca Open Graph Plugin 3.0.0.

Re: Phoca Open Graph Titles

Posted: 12 Oct 2013, 03:02
by teamtmedia
Just wanted to add a little weight into this. I have the same issue as described here and I am experiencing another common issue as below.

I am also experiencing the og:title being scraped from a module that is showing a K2 item from a category. Even when I have a K2 item or category in the main component I am still experiencing this effect. Being that I have "inspirational" business quotes my title

"services for your business" is showing as og:title="Mahatma Gandhi" and whilst I believe that M Gandhi's quote about customer service is the most important business quote ever I would much rather the og:title is the first

Code: Select all

<h?>
tag in the main component.

Again my site is on localhost so there is no option to have you poke around but here are the key lines of code for you to examine. Please ask questions.

Code: Select all

<meta property="og:title" content="Pareto principle" />
  <meta property="og:type" content="article" />

<title>teamTmedia - teamTmedia services for your business</title>

<!-- Category title -->
			<h2>our services for your business</h2> (the correct place to take the og:title from)

<a class="moduleItemTitle" href="/teamtmedia/index.php/teamtmedia-services-for-business/67/pareto-principle">Pareto principle</a> (where it is being taken from)
I post this here as I view the option that micherts is discussing to be an acceptable workaround for now as I have effective titles set throughout my site.

Re: Phoca Open Graph Titles

Posted: 28 Oct 2013, 11:37
by micherts
Hi Jan, do you have any further update on this issue?

Many thanks

Re: Phoca Open Graph Titles

Posted: 29 Oct 2013, 20:22
by Jan
Hi, as written above, there is no dependency to html ouptut (there is no search for the title).

The title is get from content values (content includes information, one of them is title, such is then used for the title). But only in case it is not overwritten by options. The plugin does not decide which parameter will be set, it is set by Joomla! rules (which parameters overwrite other parameters). In the module it is only set that if title which is set in options (the ordering of overwriting is set by Joomla!) is empty, then the article title is used.

So maybe the solution can be following, to add the page name, try to edit the plugin an let me know.

FROM:

Code: Select all

if ($this->params->get('title'.$suffix, '') != '') {
	$document->setMetadata('og:title', htmlspecialchars($this->params->get('title'.$suffix, '')));
} else if ($row->title != '') {
	$document->setMetadata('og:title', htmlspecialchars($thisTitle));
}
TO:

Code: Select all

if ($this->params->get('page_heading') != '') {
	$document->setMetadata('og:title', htmlspecialchars($this->params->get('page_heading')));
} else if ($this->params->get('title'.$suffix, '') != '') {
	$document->setMetadata('og:title', htmlspecialchars($this->params->get('title'.$suffix, '')));
} else if ($row->title != '') {
	$document->setMetadata('og:title', htmlspecialchars($thisTitle));
}
Please test and let me know (for now I am not on my pc to test it so don't know if the page_heading is included in the plugin)

Jan

Re: Phoca Open Graph Titles

Posted: 30 Oct 2013, 03:02
by teamtmedia
Thanks Jan

For me this is not working as a solution. I guess it is not getting the page-title to display (or I have the wrong settings in the plug-in).

Cheers

Justin

Re: Phoca Open Graph Titles

Posted: 30 Oct 2013, 11:36
by Jan
For now I don't have any other information about what needs to be set there. In the plugin, you get the information which is available in the content or information which is available from configuration site - In fact the plugin gets content data and there is no other way to get them from other place as plugin is the part of content :idea: