Page 1 of 2

Meta Tags in Sections and Categories

Posted: Tue Jan 17, 2006 9:20 am
by TravelGirl
Does anybody knows how to put meta tags in Sections and Categories?
Also, how to make front page showing only one (main) set of meta tags - at the moment it is showing tags from ALL articles that are listed on my front page.
One more question : How to change order of titles? At the moment it shows website title first and then page title. I would like to change it vice-versa: Page title first and then Website title.

Thanks for help and your time :)

Re: Meta Tags in Sections and Categories

Posted: Tue Jan 17, 2006 11:46 am
by Kampp
The main sites meta tags are set in the joomla site configuration!
The sections meta tags are set in the parameters where you managed the section!
The category meta tags are set in the parameters where you managed the category !
The static content meta tags are set in the parameters where you managed the static content !

You change the order of frontpage titels in the menues->mainmenu->frontpage->param. tab!

Re: Meta Tags in Sections and Categories

Posted: Tue Jan 17, 2006 12:34 pm
by TravelGirl
hi kampp,
thanks for your answer but it seems I was not clear enough to describe what I need.
I need to add following meta tags in my section and categories:

tite - added - fine :-)
description tag: how to add this?
keywords tag: what about this?

also, all page titles are shown AFTER main title ( set up in site configuration). I would need to chaneg this order so :
Page title frist and then Site title.

I hope it is clearer now.

Re: Meta Tags in Sections and Categories

Posted: Tue Jan 17, 2006 12:39 pm
by vavroom
TravelGirl wrote: Also, how to make front page showing only one (main) set of meta tags - at the moment it is showing tags from ALL articles that are listed on my front page.
This cannot be changed without hacking the core.  I believe (and several others agree) that it is incorrect behaviour.  This should be fixed with 1.1.

Regarding the order of page title/site name, this also cannot be changed without hacking the core.  This, I hope, should also be fixed in 1.1.
Kampp wrote: The sections meta tags are set in the parameters where you managed the section!
The category meta tags are set in the parameters where you managed the category !
I'm sorry, that is incorrect.  It is not possible, at this point, to set meta keywords/description for sections or categories. :(  This is a change that I am recommending and will be included in 1.1 (well, I hope 1.1, perhaps 1.2).

Kampp, please ensure, when you respond to a question, that your responses are accurate and correct.  :)  Thanks.

You may be interested in the following thread:  http://forum.joomla.org/index.php/topic ... .html  What you're asking for is covered in that thread :)

Re: Meta Tags in Sections and Categories

Posted: Tue Jan 17, 2006 12:48 pm
by TravelGirl
thanks vavroom to clarifying this and thanks for the link.

as this is a important issue, i would need to either sort it out, or give up joomla at the present and wait for release when this will be ok.

i am not good with hacks or similar. this is one of the reason why to use cms software as opose to something home made.

so, please if you know of any info how to hack this, please post link. i will be willing to try and if succesfull post my findings.

as i already invested a lot of time ( and some money too buying SFE advance and Phil Taylors addons), I beleive if this is sorted I can go live with my website.

At the moment, without this solution, I am reluctant to move to joomla with my, on search engines,  well established static site.

Thanks for your help !

Re: Meta Tags in Sections and Categories

Posted: Tue Jan 17, 2006 12:58 pm
by vavroom
I'm sorry, I can't promise when any of those will make it into the core.  I believe it'll be in 1.1, but that is still a few months away, since we're not even in beta release yet.

Believe me, I share your frustration on it.

The hacks for the title/site name is relatively simple.  It's floating around on the forum.  I remember seeing it.  If you want, I'll hunt for it and post it here for you.

The meta info handling on frontpage (and also on blog areas) is also, I believe, floating around somewhere.  I can also find it (or try to work one out, it *is* needed).

The meta info for categories and section is problematic.  It can't be solved without database changes (to my knowledge).  I think that in the greater scheme of SEO, if all your other SEO techniques are solid, you won't be penalised too badly if you are short on content specific keywords/description for the sections/categories.  Yes, it would be *much* better for them to be there, but they are just a part of it.  In fact, some people will argue that meta keywords are useless (I disagree, but still, would agree that they aren't quite as important as we sometimes make them to be).

Sooooo, to make a long story short.  If you want me to explain the couple hacks for title/site and the frontpage keywords, because you want to go ahead with your site nonetheless, I'll be glad to do so.  I won't spend the time if you think you won't use it though.  Do let me know.  :)

Re: Meta Tags in Sections and Categories

Posted: Tue Jan 17, 2006 1:24 pm
by TravelGirl
thanks for your prompt answer.

if you have some time that would be great to post help so i can at least sort out these two things. that will be very helpful.
i will then apply it and monitor how things are progressing with my serps positions.

perhaps, to be on the safe side, i can start moving only part of my site to joomla, and keep the rest static until it proves there is no harm in not having these posibilities...

another idea that comes to my mind now is perhaps to find solution somehow to avoid using sections in my main menu, and instead of it use articles. i'm not shure how to go about this, but can think about it...

Re: Meta Tags in Sections and Categories

Posted: Tue Jan 17, 2006 1:34 pm
by gws
I am a long way from a seo expert but the botMetafly  mambot helped me get my meta information into better shape. You can find it here http://forum.joomla.org/index.php/topic ... .html    have a play and see if it helps, one of its strengths is to Analise your content and show the most frequent words on the page.

Re: Meta Tags in Sections and Categories

Posted: Wed Jan 18, 2006 12:12 am
by vavroom
Switching title/sitename:

In your files, open /includes/joomla.php

Around line 475 (may vary from version to version), find:

Code: Select all

$this->_head['title'] = $title ? $GLOBALS['mosConfig_sitename'] . ' - '. $title : $GLOBALS['mosConfig_sitename'];
Replace with:

Code: Select all

$this->_head['title'] = $title ? $title .' - '. $GLOBALS['mosConfig_sitename'] : $GLOBALS['mosConfig_sitename'];
Make sure you back up your file first, in case it causes you problems, but it shouldn't.

Thanks to Jinx who pointed out the obvious to me, which I had been looking at and not seeing... :)

Re: Meta Tags in Sections and Categories

Posted: Wed Jan 18, 2006 12:26 am
by TravelGirl
WOW ! it works !
Thanks vavroom and Jinx!
:-*

Re: Meta Tags in Sections and Categories

Posted: Wed Jan 18, 2006 12:37 am
by vavroom
Glad that one worked for you.  :)

Now, try this one:

To stop individual items' meta info to be appended on the frontpage:

In /includes/joomla.php, around line 499, find function appendMetaTag

Code: Select all

	function appendMetaTag( $name, $content ) {
		$name = trim( htmlspecialchars( $name ) );
		$n = count( $this->_head['meta'] );
		for ($i = 0; $i < $n; $i++) {
			if ($this->_head['meta'][$i][0] == $name) {
				$content = trim( htmlspecialchars( $content ) );
				if ( $content ) {
					if ( !$this->_head['meta'][$i][1] ) {
						$this->_head['meta'][$i][1] = $content ;
					} else {
						$this->_head['meta'][$i][1] = $content .', '. $this->_head['meta'][$i][1];
					}
				}
				return;
			}
		}
		$this->addMetaTag( $name , $content );
	}
Replace with this:

Code: Select all

	function appendMetaTag( $name, $content ) {
	    global $mosConfig_MetaDesc, $mosConfig_MetaKeys, $option;
	    $name = trim( htmlspecialchars( $name ) );
	    $n = count( $this->_head['meta'] );

// to correct description display (avoid coma after full stop).
	if (strtolower($name) == "description") $delimiter = " ";  else $delimiter = ", ";

	    for ($i = 0; $i < $n; $i++) {
	        if ($this->_head['meta'][$i][0] == $name) {
			    $content = trim( htmlspecialchars( $content ) );
				$this->_head['meta'][$i][1] .= (strlen($this->_head['meta'][$i][1]) > 0 && strlen($content) > 0 ? $delimiter : '') . $content; 

// we're changing default behaviour for home page
if ( $option == "com_frontpage" && strtolower($name) == "description") $this->_head['meta'][$i][1] = $mosConfig_MetaDesc ;
if ( $option == "com_frontpage" && strtolower($name) == "keywords") $this->_head['meta'][$i][1] = $mosConfig_MetaKeys ;
				return;
			}
		}
		
$this->addMetaTag( $name, $content );
}
BEWARE: This code appears to work on Joomla! 1.0.5.  I did not have the time to do extensive testing. 

I found it as a hack from the old mambo server forum. 
//Edit: forgot the url: http://forum.mamboserver.com/showthread ... +frontpage

It works for the purpose of stopping the inclusion of content items' meta on the frontpage, but it *may* cause issues.  It will not stop appending the global description to the individual meta when viewing an individual item (though it appears to show the global *after* the individual item).

Lemme know how you get on :)

Re: Meta Tags in Sections and Categories

Posted: Wed Jan 18, 2006 3:37 pm
by TravelGirl
yes, this one works for me too :) :) :)
no more annoying metas on front page
i use 1.0.5 version, will check later too when I upgrade to more up to date version.
thanks for your time and support vavroom...

Re: Meta Tags in Sections and Categories

Posted: Wed Jan 18, 2006 8:40 pm
by vavroom
You're welcome TravelGirl :)  Glad it worked for you.

Just make sure to make note of those changes somewhere safe, that you wont' lose, and you'll know where to find them, so you can go in and apply the changes again when you next upgrade your system (until these issues are actually fixed in the core!).

Cheers

Re: Meta Tags in Sections and Categories

Posted: Sun Jan 22, 2006 7:30 am
by wazimm
after making the changes to includes/ joomla.php, I got this
Fatal error: Call to undefined function: addmetatag() in /home/club509/www.superhaitian.com/docs/includes/joomla.php on line 499
also, I'm using Joomla version 1.0.7

Re: Meta Tags in Sections and Categories

Posted: Sun Jan 22, 2006 8:09 pm
by vavroom
As I said, it worked in 1.0.5, haven't tried it in 1.0.7.  The solution was devised for Mambo, so I'm not surprised that as we go further and further from Mambo, it doesn't work.  YOu'll have to look at the new code, compare with what I suggest, and try and figure it out.  Good luck

Re: Meta Tags in Sections and Categories

Posted: Wed Jan 25, 2006 5:06 am
by jhudson08
vavroom, great tip, it worked like a charm.

the only wierd side effect was that my home page title now reads:

Home - "My Custom Page Title Here - More Page Title"

I guess the word Home used to be on the end of the title, but I never even noticed it before.

Any clue where I could remove that or name it something else at least? I know this is a dumb question but I've only been using joomla for a week. (i love it)

Re: Meta Tags in Sections and Categories

Posted: Wed Jan 25, 2006 5:24 am
by vavroom
@jhudson, have you applied the hack I describe in reply #8?  If not, that should do it.  If you have, then, for some reason, you already had your title behaviour switched.  Apply the hack in reverse and that should do it, I think :)

Re: Meta Tags in Sections and Categories

Posted: Sat Feb 04, 2006 4:32 am
by magic
BTW:
In some cases we would like to have category name inside Title tag.
For example: in case of selected section's category, when Joomla does not show in Title anything more than Site Name - Menu Name.

To do it open .../components/com_content/content.php and find the code mentioned below (close to line 358 inside function showCategory)

Code: Select all

	$pagetitle = '';
	if ( $Itemid ) {
		$menu = new mosMenu( $database );
		$menu->load( $Itemid );
		$pagetitle = $menu->name;
	} // if
Change it for:

Code: Select all

//magic : category in title
if ($category) {
$categoryName=$category->name;

   $pagetitle = ''; 
if ( $Itemid ) {
  $menu = new mosMenu( $database );
  $menu->load( $Itemid );
  $pagetitle = $menu->name.': '.$categoryName;
}
}
In effect your Title will look like: "Site Name - Menu Name : Category Name"

In case of the most of the rest of functions in content.php you can use $row->category for this (example below):

Code: Select all

  // page title / magic uwaga
  // $mainframe->setPageTitle( $row->title );
  $magicVariable = $row->category.' : '.$row->title; // magic : added
  $mainframe->setPageTitle( $magicVariable ); // magic : changed
In effect (eg. function showItem) your Title will look like: "Site Name - Category Name : Item Title"

Have fun!

P.S. Credits are going to zwiastun

Re: Meta Tags in Sections and Categories

Posted: Wed Mar 01, 2006 2:39 am
by spinfx
Hi

We are also keen to see keywords and description metadata on sections and categories because we use "mod_relatedpagesXTD" extensively across the site, and while it works great for all the content pages within a category, we cannot include the category description text (on the category intro page) in the list of related items.

Our site, when published, will probably be the biggest Joomla site you've ever seen, in terms of content.

So the sooner we can have these metadata on sections/categories, the better - please  ;D

Cheers, David

Re: Meta Tags in Sections and Categories

Posted: Thu Mar 02, 2006 10:01 am
by damo
are these good for 1.0.8?:
vavroom wrote: Switching title/sitename:

In your files, open /includes/joomla.php

Around line 475 (may vary from version to version), find:

Code: Select all

$this->_head['title'] = $title ? $GLOBALS['mosConfig_sitename'] . ' - '. $title : $GLOBALS['mosConfig_sitename'];
Replace with:

Code: Select all

$this->_head['title'] = $title ? $title .' - '. $GLOBALS['mosConfig_sitename'] : $GLOBALS['mosConfig_sitename'];
Make sure you back up your file first, in case it causes you problems, but it shouldn't.

Thanks to Jinx who pointed out the obvious to me, which I had been looking at and not seeing... :)
and
vavroom wrote: Glad that one worked for you.  :)

Now, try this one:

To stop individual items' meta info to be appended on the frontpage:

In /includes/joomla.php, around line 499, find function appendMetaTag

Code: Select all

	function appendMetaTag( $name, $content ) {
		$name = trim( htmlspecialchars( $name ) );
		$n = count( $this->_head['meta'] );
		for ($i = 0; $i < $n; $i++) {
			if ($this->_head['meta'][$i][0] == $name) {
				$content = trim( htmlspecialchars( $content ) );
				if ( $content ) {
					if ( !$this->_head['meta'][$i][1] ) {
						$this->_head['meta'][$i][1] = $content ;
					} else {
						$this->_head['meta'][$i][1] = $content .', '. $this->_head['meta'][$i][1];
					}
				}
				return;
			}
		}
		$this->addMetaTag( $name , $content );
	}
Replace with this:

Code: Select all

	function appendMetaTag( $name, $content ) {
	    global $mosConfig_MetaDesc, $mosConfig_MetaKeys, $option;
	    $name = trim( htmlspecialchars( $name ) );
	    $n = count( $this->_head['meta'] );

// to correct description display (avoid coma after full stop).
	if (strtolower($name) == "description") $delimiter = " ";  else $delimiter = ", ";

	    for ($i = 0; $i < $n; $i++) {
	        if ($this->_head['meta'][$i][0] == $name) {
			    $content = trim( htmlspecialchars( $content ) );
				$this->_head['meta'][$i][1] .= (strlen($this->_head['meta'][$i][1]) > 0 && strlen($content) > 0 ? $delimiter : '') . $content; 

// we're changing default behaviour for home page
if ( $option == "com_frontpage" && strtolower($name) == "description") $this->_head['meta'][$i][1] = $mosConfig_MetaDesc ;
if ( $option == "com_frontpage" && strtolower($name) == "keywords") $this->_head['meta'][$i][1] = $mosConfig_MetaKeys ;
				return;
			}
		}
		
$this->addMetaTag( $name, $content );
}
BEWARE: This code appears to work on Joomla! 1.0.5.  I did not have the time to do extensive testing. 

I found it as a hack from the old mambo server forum. 
//Edit: forgot the url: http://forum.mamboserver.com/showthread ... +frontpage

It works for the purpose of stopping the inclusion of content items' meta on the frontpage, but it *may* cause issues.  It will not stop appending the global description to the individual meta when viewing an individual item (though it appears to show the global *after* the individual item).

Lemme know how you get on :)

Re: Meta Tags in Sections and Categories

Posted: Thu Mar 02, 2006 7:24 pm
by vavroom
damo wrote: are these good for 1.0.8?:
I haven't even installed 1.0.8 yet.  Your best bet is to back up your files, and try the changes, see if it works/breaks.

Re: Meta Tags in Sections and Categories

Posted: Tue Mar 14, 2006 2:54 am
by Pesto
The swapping of the title/sitename works in 1.08. That was the hack I needed. To me, that is far more important than the meta tags hack.

I will wait a few more months until 1.1 comes out for the team to clear up issues like that.

one thing I did combine with swap was a custom string for the com_frontpage, as follows, in com_content, around line 190

Code: Select all

// Dynamic Page Title
	$mainframe->SetPageTitle( 'Your Custom Homepage Text Here' );
mixing the two will make your home page much stronger from an SEO standpoint. This ONLY affects your home page TITLE tag.

HTH

Pesto

Re: Meta Tags in Sections and Categories

Posted: Wed Mar 22, 2006 1:20 am
by 72dpi
Hi All,

Just wondering if there are any developments on this?

I will be pretty stoked to see a move towards streamlining keywords & metadata for Sections and categories. In fact, it is extremely essential, considering the inbuilt search engine completely ignores sections and categories, and the fact that related items bot doesn't work on these main areas.

Hopefully it has been added to consideration to the core dev team, i know they have their hands really full, and we Appreciate it so much.
Here's to hoping that this becomes a consideration!

Re: Meta Tags in Sections and Categories

Posted: Thu Mar 30, 2006 4:10 am
by prameya
thanks... implemented that on my website.. and works perfectly... i still need to find a way to change the forums layout.. its joomlaboard or something.. it was a component.. and it was direct and easy install.. but it looks.. bad...

the website is www.merosansar.info incase you want to see...

Re: Meta Tags in Sections and Categories

Posted: Sat Apr 01, 2006 7:53 pm
by caleb2001r
Pesto wrote: The swapping of the title/sitename works in 1.08. That was the hack I needed. To me, that is far more important than the meta tags hack.

I will wait a few more months until 1.1 comes out for the team to clear up issues like that.

one thing I did combine with swap was a custom string for the com_frontpage, as follows, in com_content, around line 190

Code: Select all

// Dynamic Page Title
	$mainframe->SetPageTitle( 'Your Custom Homepage Text Here' );
mixing the two will make your home page much stronger from an SEO standpoint. This ONLY affects your home page TITLE tag.

HTH

Pesto
Thanks, just what I was looking for. :)

Note:  Just to clarify, this done in componenets/com_content/content.php

Re: Meta Tags in Sections and Categories

Posted: Mon Apr 03, 2006 2:26 am
by spinfx
Pesto wrote: That was the hack I needed. To me, that is far more important than the meta tags hack.
I still need meta tags (in particular the keywords) for Sections and Categories. This is so appropriate Sections and Categories will be included in the "Related Pages XTD" module, which relies on specific keywords to show related content.

Anyone yet have an idea how this might be achieved?

Cheers, David  :) 

Re: Meta Tags in Sections and Categories

Posted: Wed Apr 05, 2006 6:47 am
by elogicmedia
I want to add this to my title tag:

from this:

Page Name - Site name

to

Page Name - Site Name - Online Quality Craft Brewing Supplies

how can I do this? I tried: (line 471 of joomla.php)

$this->_head['title'] = $title ? $title .' - '. $GLOBALS['mosConfig_sitename'] : $GLOBALS['mosConfig_sitename'].'- Online Quality Craft Brewing Supplies';

But it didn't work?

Re: Meta Tags in Sections and Categories

Posted: Fri Apr 21, 2006 4:27 pm
by koestel
does not go with mambo 4.5.2 Fr the title are to record in menu
but not enabled in frontend??  ???...

Re: Meta Tags in Sections and Categories

Posted: Thu Apr 27, 2006 12:28 pm
by skootle
caleb2001r wrote:
Pesto wrote: The swapping of the title/sitename works in 1.08. That was the hack I needed. To me, that is far more important than the meta tags hack.

I will wait a few more months until 1.1 comes out for the team to clear up issues like that.

one thing I did combine with swap was a custom string for the com_frontpage, as follows, in com_content, around line 190

Code: Select all

// Dynamic Page Title
	$mainframe->SetPageTitle( 'Your Custom Homepage Text Here' );
mixing the two will make your home page much stronger from an SEO standpoint. This ONLY affects your home page TITLE tag.

HTH

Pesto
Thanks, just what I was looking for. :)

Note:  Just to clarify, this done in componenets/com_content/content.php
I need to clarify further, this did not work for me until commenting out the following code.  Here was the full change I need to make in 1.08 and it worked:

Code: Select all

// Dynamic Page Title
    $mainframe->SetPageTitle( 'Custom Title Here' );// Makes the page title more dynamic, uses the pagetitle parameter instead of the menu name;
	//if (  $params->get( 'header' )  == "") {
	//$mainframe->SetPageTitle( $menu->name );		
	//}else {
	//	$mainframe->SetPageTitle( $params->get( 'header' ) );
	//}
	
Thanks for the help!  8)

Re: Meta Tags in Sections and Categories

Posted: Tue Jun 06, 2006 2:18 am
by caleb2001r
Alrighty guys, 1.09 is out now, time for some testing on the above solutions in the new revision.  Anyone up to the challenge?  I'm scared to, lol. :)