Advertisement

How to add meta tags to Joomla pages?

General questions relating to Joomla! There are other boards for more specific help on Joomla! features and extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
User avatar
sergefa
Joomla! Intern
Joomla! Intern
Posts: 50
Joined: Sat May 20, 2006 11:07 pm

How to add meta tags to Joomla pages?

Post by sergefa » Thu Jul 13, 2006 6:02 am

Hallo!
I did the search but I got no answer so I place my question here.
Is there any was of adding meta tags to Joomla pages? I installed Joomap and want my site appear in the Google search engine but the Google demands the confirmation of my ownership of the my site and asks me to place Google meta tags on my pages. Could somebody tell me whete Can I add meta tags to my pages?
Thank you

Advertisement
User avatar
thejasondean
Joomla! Apprentice
Joomla! Apprentice
Posts: 39
Joined: Tue Nov 01, 2005 2:39 pm
Contact:

Re: How to add meta tags to Joomla pages?

Post by thejasondean » Thu Jul 13, 2006 7:15 am

First of all make sure you got

Code: Select all

<?php mosShowHead(); ?>
in the head of your template.

Also when editing an item you will find a tab called "Meta Info" on the right.
You can add as much keywords as you want there. Joomla will convert
them automaticaly to meta tags.
Windows come with amazing GUI and ergonomics that give you over 20% extra productivity !
Also they come with amazing games that make you loose over 120% of that productivity !

User avatar
riki
Joomla! Apprentice
Joomla! Apprentice
Posts: 28
Joined: Fri Aug 04, 2006 3:24 pm
Location: Japan
Contact:

Re: How to add meta tags to Joomla pages?

Post by riki » Thu Aug 17, 2006 1:32 pm

I added this customisation to the includes/frontend.php file

Code: Select all

// ------------------------------------------------------------------------------------------
// ASSEMBLES HEAD TAGS
// ------------------------------------------------------------------------------------------

function mosShowHead() {
	global $database, $option, $my, $mainframe, $_VERSION, $task, $id;
	global $mosConfig_MetaDesc, $mosConfig_MetaKeys, $mosConfig_live_site, $mosConfig_sef, $mosConfig_absolute_path, $mosConfig_sitename, $mosConfig_favicon, $mosConfig_locale;

	if ($my->id || $mainframe->get( 'joomlaJavascript' )) {
		?>
		<script language="JavaScript" src="<?php echo $mosConfig_live_site;?>/includes/js/joomla.javascript.js" type="text/javascript"></script>
		<?php
	}

	// *************** DEFINE META TAGS ***************

	$mainframe->appendMetaTag( 'description', $mosConfig_MetaDesc );
	$mainframe->appendMetaTag( 'keywords', $mosConfig_MetaKeys );
	$mainframe->addMetaTag( 'generator', $_VERSION->PRODUCT . " - Copyright: Open Source Matters, " . date("Y") . ". All Rights Reserved" );
	$mainframe->addMetaTag( 'audience', 'general' );
	$mainframe->addMetaTag( 'author', $mosConfig_sitename );
	$mainframe->addMetaTag( 'company', $mosConfig_sitename );
	$mainframe->addMetaTag( 'copyright', "Copyright: " . $mosConfig_sitename . ", " . date("Y") . ". All Rights Reserved" );
	$mainframe->addMetaTag( 'distribution', 'global' );
	$mainframe->addMetaTag( 'language', $mosConfig_locale );
	$mainframe->addMetaTag( 'rating', 'all' );
	$mainframe->addMetaTag( 'revisit-after', '7 days' );
	$mainframe->addMetaTag( 'robots', 'index, follow' );
	$mainframe->addMetaTag( 'title', $mosConfig_sitename );
	
	// *************** CACHE ACTIVATION - echo $mainframe->getHead(); (see: includes/joomla.php) ***************
	
	$cache =& mosCache::getCache('com_content');
	echo $cache->call('mainframe->getHead', $_SERVER['QUERY_STRING'], $id);
	
	// *************** WRITE HTTP-EQUIV ATTRIBUTES ***************
	
	echo "\n<!-- HTTP-EQUIV ATTRIBUTES ************************* -->\n\n";
	echo "<meta http-equiv=\"content-language\" content=\"$mosConfig_locale\" />\n";
	echo "<meta http-equiv=\"content-script-type\" content=\"text/javascript\" />\n";
	echo "<meta http-equiv=\"content-style-type\" content=\"text/css\" />\n";
	echo "<meta http-equiv=\"imagetoolbar\" content=\"no\" />\n";
	echo "<meta http-equiv=\"window-target\" content=\"_top\" />\n";
	echo "\n<!-- ASSOCIATED FILES ************************* -->\n\n";

	if ( isset($mosConfig_sef) && $mosConfig_sef ) {
		echo "<base href=\"$mosConfig_live_site/\" />\r\n";
	}

User avatar
riki
Joomla! Apprentice
Joomla! Apprentice
Posts: 28
Joined: Fri Aug 04, 2006 3:24 pm
Location: Japan
Contact:

Re: How to add meta tags to Joomla pages?

Post by riki » Thu Aug 17, 2006 1:56 pm

Here's a basic look at how it renders

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" />
<title>XYZ Holdings - Home</title>

<!-- HTTP-META TAGS ************************* -->

<meta name="description" content="My homepage" />
<meta name="keywords" content="riki, japan, joomla, etc, etc, etc" />
<meta name="generator" content="Joomla! - Copyright: Open Source Matters, 2006. All Rights Reserved" />
<meta name="audience" content="general" />
<meta name="author" content="XYZ Holdings" />
<meta name="company" content="XYZ Holdings" />
<meta name="copyright" content="Copyright: XYZ Holdings, 2006. All Rights Reserved" />
<meta name="distribution" content="global" />

<meta name="language" content="en_AU" />
<meta name="rating" content="all" />
<meta name="revisit-after" content="7 days" />
<meta name="robots" content="index, follow" />
<meta name="title" content="XYZ Holdings" />

<!-- HTTP-EQUIV ATTRIBUTES ************************* -->

<meta http-equiv="content-language" content="en_AU" />
<meta http-equiv="content-script-type" content="text/javascript" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="imagetoolbar" content="no" />
<meta http-equiv="window-target" content="_top" />

<!-- ASSOCIATED FILES ************************* -->

<link rel="alternate" type="application/rss+xml" title="XYZ Holdings" href="http://www.xyz.com/index2.php?option=com_rss&feed=RSS2.0&no_html=1" />

<link rel="shortcut icon" href="http://www.xyz.com/favicon.ico" />
<link href="templates/mafa/css/template_css.css" rel="stylesheet" type="text/css" media="screen" />

<!-- JAVASCRIPT ************************* -->

<script language="javascript" type="text/JavaScript" src="http://www.xyz.com/includes/js/force_top.js"></script>
<script language="javascript" type="text/JavaScript" src="http://www.xyz.com/includes/js/onloader_art.js"></script>
<script language="javascript" type="text/JavaScript" src="http://www.xyz.com/includes/js/popups.js"></script>
<script language="javascript" type="text/JavaScript" src="http://www.xyz.com/includes/js/rollovers.js"></script>

</head>
<body onload="loadFunction();">

<!-- HEAD CONTENT ************************* -->

User avatar
riki
Joomla! Apprentice
Joomla! Apprentice
Posts: 28
Joined: Fri Aug 04, 2006 3:24 pm
Location: Japan
Contact:

Re: How to add meta tags to Joomla pages?

Post by riki » Thu Aug 17, 2006 2:00 pm

I did one other small change in the includes/joomla.php file.

Code: Select all

	function getHead() {
		$head = array();
		$head[] = '<title>' . $this->_head['title'] . "</title>\n\n<!-- HTTP-META TAGS ************************* -->\n"; 
		foreach ($this->_head['meta'] as $meta) {
			if ($meta[2]) {
				$head[] = $meta[2];
			}
			$head[] = '<meta name="' . $meta[0] . '" content="' . $meta[1] . '" />';
			if ($meta[3]) {
				$head[] = $meta[3];
			}
		}
		foreach ($this->_head['custom'] as $html) {
			$head[] = $html;
		}
		return implode( "\n", $head ) . "\n";
	}

User avatar
bossies
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 112
Joined: Tue Oct 11, 2005 3:53 pm
Location: Malmesbury - South Africa
Contact:

Re: How to add meta tags to Joomla pages?

Post by bossies » Fri Aug 18, 2006 10:41 am

Go to extensions and then top rated extentions - find the iJoomla Metatag Generator.  This is really awsome and will get your site on the map quick!
Malmesbury - South Africa
http://www.voiceconnect.co.za Voiceconnect
http://www.atmalmesbury.co.za

ranshubert
Joomla! Apprentice
Joomla! Apprentice
Posts: 36
Joined: Thu Jun 29, 2006 8:54 am
Contact:

Re: How to add meta tags to Joomla pages?

Post by ranshubert » Fri Oct 13, 2006 11:32 am

Yes, but the Metatag generator does not let you add new tags, only edit the existing ones (keywords, description), so in this case it is not helpful...

Rans.

User avatar
leolam
Joomla! Master
Joomla! Master
Posts: 20674
Joined: Mon Aug 29, 2005 10:17 am
Location: Netherlands/ Germany/ S'pore/Bogor/ North America/
Contact:

Re: How to add meta tags to Joomla pages?

Post by leolam » Fri Oct 13, 2006 11:50 am

what do i miss in this entire discussion?
@ ranshubert > your remark is incorrect check the metatag generator more careful!

@ all : in every Joomla page you ahve the option to add meta data: right top > meta info and add your info and done.

why all those hacks etc? no need at all! Guess whats happening when a new release is out and you want to yupgrade? Yes! you have to do it all again.. solutions described here sorry : not too good!

iJoomla metatag generator is a tool to add etatags based on content.a very good and effective tool! Joomla provide already loads of assistance as described. NO need fo hacks!

cheers
Leo
Joomla Professional Support Services
Over 35.000 support requests solved
Just contact us through the Joomla Support channels if you want help

ranshubert
Joomla! Apprentice
Joomla! Apprentice
Posts: 36
Joined: Thu Jun 29, 2006 8:54 am
Contact:

Re: How to add meta tags to Joomla pages?

Post by ranshubert » Sat Oct 14, 2006 9:49 am

Sorry, but I'm not sure I fully understood you.
I am aware that you can edit the keyword & description meta tags directly via each content item or using the iJoomla generator.
But what if I want to add a NEW meta tag that doesn't exist? (this request comes from Google sitemaps). How do I do that?

Cheers,
Rans

gws
Joomla! Champion
Joomla! Champion
Posts: 6728
Joined: Tue Aug 23, 2005 1:56 pm
Location: South coast, UK
Contact:

Re: How to add meta tags to Joomla pages?

Post by gws » Sat Oct 14, 2006 12:12 pm

I am sure I have seen a module or bot in the extensions that does this for you, have a search in the extensions.

Advertisement

Locked

Return to “General Questions - 1.0.x”