Joomla Custom Page Titles in Template

Joomla Custom Page Titles in Template

How to Customize Page Titles in Template

If you want to customize your Joomla Site's page titles to your own liking, you may do this with adding some customization to your template files.
You can place the following code anywhere in your template index.php.

// we are getting the current title of the page
$title = $this->getTitle();
// and we are adding our site name to it.
// first we get the site name from global configration

$app = JFactory::getApplication();
$ourSiteName = $app->getCfg( 'sitename' );

// and we set the new title together with our site name from!
$this->setTitle( $title . ' - ' . $ourSiteName . ' );