Phoca Open Graph Titles
-
- Phoca Newbie
- Posts: 4
- Joined: 05 Oct 2013, 11:12
Phoca Open Graph Titles
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.
Thanks for your help.
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Open Graph Titles
Hi, not sure if I understand correctly what exactly is missing?
First the title is set by item:
If it is the category view, then from category:
In case it it set in parameters:
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 )
The same with site name:
First the title is set by item:
Code: Select all
$thisTitle = $row->title;
Code: Select all
if (isset($cItem[0]->title) && $cItem[0]->title != '') {
$thisTitle = $cItem[0]->title;
}
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));
}
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')));
}
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 4
- Joined: 05 Oct 2013, 11:12
Re: Phoca Open Graph Titles
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
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
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Open Graph Titles
Hi, not sure which version you are running, maybe some old which does not have such feature?
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 4
- Joined: 05 Oct 2013, 11:12
Re: Phoca Open Graph Titles
I'm running Joomla! 3.1.5, Phoca Open Graph Plugin 3.0.0.
-
- Phoca Newbie
- Posts: 3
- Joined: 12 Oct 2013, 02:53
Re: Phoca Open Graph Titles
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
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.
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.
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?>
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)
-
- Phoca Newbie
- Posts: 4
- Joined: 05 Oct 2013, 11:12
Re: Phoca Open Graph Titles
Hi Jan, do you have any further update on this issue?
Many thanks
Many thanks
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Open Graph Titles
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:
TO:
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
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));
}
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));
}
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 3
- Joined: 12 Oct 2013, 02:53
Re: Phoca Open Graph Titles
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
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
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Open Graph Titles
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
If you find Phoca extensions useful, please support the project