Changing Page Title and Meta Info in Joomla

Posted by: twmeier

Tagged in: Programming , Joomla , Components

Changing the Page Title and the Meta Tags (keywords and description) in a Joomla Component is simple (this does not apply to articles or the home page of your site).

The first step is to include the following line of code inside php tags:

global $mainframe;

Then simply use the following functions to change the Page Title, Meta Keywords and the Meta Description:

$mainframe->SetPageTitle("Some Page Title");
$mainframe->appendMetaTag( "description", "Some Description.");
$mainframe->appendMetaTag( "keywords", "keyword, keyword2");

Since this code is php, it should all be inside php tags like it is below:


global $mainframe;

$mainframe->SetPageTitle("Some Page Title");
$mainframe->appendMetaTag( "description", "Some Description.");
$mainframe->appendMetaTag( "keywords", "keyword, keyword2");

?>

That is all there is too it. You will notice that your Meta Description and Keywords will be appended to your global Meta Description and Keywords, which can be found in the "Global Configurations" in the backend of Joomla.

Comments (2)add comment

Jason said:

0
Which page?
Hi
Can you tell me where to put this code if i wish to change the front page?
Thanks
 
July 24, 2009 | url
Votes: +1

Trevor M. said:

Trevor M.
Only in a custom component.
This tutorial should only be used for components, and not for articles or menu items such as the home page.

To change the page title of the home page, you need to find the menu item that links to the home page and edit the page title there.
 
July 28, 2009
Votes: +0

Leave a Comment

busy