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.