Need category name in browser meta title

Phoca Gallery - image gallery extension
Antoniosan
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 11 Oct 2015, 13:15

Need category name in browser meta title

Post by Antoniosan »

Hello,

I need to add the category name in the browser category view page title because Google Webmasters Tools inform me that I have a lot of meta title duplicated.

I have been trying all configurations in Phoca Gallery and checking Joomla menu items too but I think this has to be solve with a code file.

(Joomla 3.4.4 – Phocagallery v4.2.1)

Right now I have something like this on each category page:

myswebsite.com/fotos/category/1-gastronomia-comida

Meta title (browser): Fotos (wich is menu item name)

Category name is: Gastronomia Comida

What I need is to add category name in meta title (browser), something as follow:

Fotos – Gastronomía Comida

If I change the menu item name it’s the same, gallery name does not appear and if I leave it empty It does not appear neither. I try all possible configurations in Joomla, Phoca Galllery and etc.


I can`t find the way to do it but I see that it is done in the phoca.cz demopage:

phoca.cz/demo/gallery-categories

Where you can see the meta title (browser) in categories view is: Gallery Categories

Then if you click any category you have something like this:

phoca.cz/demo/gallery-categories/category/20-austria-wasserloch

But here meta title (browser) changed (“just what I need”) to:

Gallery Categories - Austria – Wasserloch

Category name is: Austria – Wasserloch


So in my case I would need:

Fotos – Gastronomía Comida


How can I do it?

Thanks in advance.
Last edited by Antoniosan on 16 Oct 2015, 14:13, edited 1 time in total.

Tags:
christine
Phoca Hero
Phoca Hero
Posts: 2819
Joined: 28 Nov 2010, 17:20

Re: Need category name in browser meta title

Post by christine »

Hi Antoniosan,

in your example: https://www.phoca.cz/demo/gallery-categories ... wasserloch

the browser title: "Gallery Categories - Austria – Wasserloch" comes from here: <title>Gallery Categories - Austria - Wasserloch</title>
and not from: <meta name="keywords" content= etc." and/or: <meta name="description etc." May be, here you have too many keywords (?)

So, above title is implemented: Menue > your menue > pageview (similar) pagetitle in browser> title of your above example

If there is NO alternate text given, then the default menue title will be taken.

Kind regards, Christine
Antoniosan
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 11 Oct 2015, 13:15

Re: Need category name in browser meta title

Post by Antoniosan »

Ok.

Thank you!
windextreme
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 26 Apr 2016, 19:54

Re: Need category name in browser meta title

Post by windextreme »

Hi,
Sorry to disturb but it looks like I have the same question but don't understand solution to display right browser title.
I have one menu item, let's name it "Gallery"(Галерея in Russian www.wind-extreme.com) on my website and assigned it as "List Of Categories (Categories View)". When I open this menu item I see the list of my categories. The browser title on this page is "Gallery". But when I then open any of my categories (let's say "Philippines") the browser title doesn't change and still showes "Gallery" but not "Philippines" or "Gallery-Philippines" so it doesn't change.

Could you please help me what I have to do to have browser title the same way as you have here, for example:
https://www.phoca.cz/demo/gallery-categories - <title>Gallery Categories</title>
https://www.phoca.cz/demo/gallery-categories ... wasserloch - <title>Gallery Categories - Austria - Wasserloch</title>

in my case it is always <title>Gallery Categories</title>
christine
Phoca Hero
Phoca Hero
Posts: 2819
Joined: 28 Nov 2010, 17:20

Re: Need category name in browser meta title

Post by christine »

Hi windextreme,
windextreme wrote:in my case it is always <title>Gallery Categories</title>
For me it looks OK:
Examples:
This category: http://www.wind-extreme.com/foto-galere ... -2015.html
Browsertitle shows: Фото галерея Wind-Extreme - Филиппины 2015

http://www.wind-extreme.com/foto-galere ... -2015.html
it shows: Фото галерея Wind-Extreme - Перу 2015
etc.

Kind regards, Christine
windextreme
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 26 Apr 2016, 19:54

Re: Need category name in browser meta title

Post by windextreme »

christine wrote:Hi windextreme,
windextreme wrote:in my case it is always <title>Gallery Categories</title>
For me it looks OK:
Kind regards, Christine
Hi Christine,
Thanks a lot for your reply. I've found already the solution. I had to uncoment following code in /components/com_phocagallery/views/category/view.html.php

Code: Select all

/*   if (isset($this->category->title) && $this->category->title != '') {
         $title = $title .' - ' .  $this->category->title;
      } */
Should it be commented from the beginning?
After that everything works perfect.
plamen
Phoca Professional
Phoca Professional
Posts: 100
Joined: 16 Mar 2014, 13:23

Re: Need category name in browser meta title

Post by plamen »

Old topic, but I've come to this recently checking SEO optimization.
I also uncommented rows 2070-2072 cited in the previous post.
Better to do it with override.
It is interesting why the developer left this commented. Jan?
Better to have each category and each picture with its own page title, or at least to have an option is settings for switch On/Off.

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

Re: Need category name in browser meta title

Post by Jan »

Hi, this was completely changed to:

Code: Select all

if (empty($title)) {
			$title = htmlspecialchars_decode($app->getCfg('sitename'));
		} else if ($app->getCfg('sitename_pagetitles', 0) == 1) {
			$title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title);
			
			if ($this->tmpl['display_cat_name_title'] == 1 && isset($this->category->title) && $this->category->title != '') {
				$title = $title .' - ' .  $this->category->title;
			}
			
		} else if ($app->getCfg('sitename_pagetitles', 0) == 2) {
			
			if ($this->tmpl['display_cat_name_title'] == 1 && isset($this->category->title) && $this->category->title != '') {
				$title = $title .' - ' .  $this->category->title;
			}
		
			$title = JText::sprintf('JPAGETITLE', $title, htmlspecialchars_decode($app->getCfg('sitename')));
		}
If I do some change, I comment it, because code behaves differently on different environments, can be influenced by other part or it can influence negatively other parts, etc. Many changes I did based on users's feedback were removed as e.g. they were in conflict with other part of the system, etc. etc. So before completely cleaning, there is some time to really test the new change.

Jan
If you find Phoca extensions useful, please support the project
plamen
Phoca Professional
Phoca Professional
Posts: 100
Joined: 16 Mar 2014, 13:23

Re: Need category name in browser meta title

Post by plamen »

My sitename_pagetitles was 0 due to other plugin - Title Manager.
That's why this code was not executed. Now things go as supposed.
Thanks.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Need category name in browser meta title

Post by Jan »

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