In this article i am going to explain the easy way to customizing your dynamic page title. For SEO purpose there is a common requirement to customize the every page titles and meta descriptions must be unique.You can be placed below codes anywhere in your current template’s index.php, although most people tend to insert it near the top of the page or within the
tags.
1 2 3 4 5 |
<?php $title = $this->getTitle(); ?> |
1 2 3 4 5 6 |
<?php $app = JFactory::getApplication(); $this->setTitle( $title . ' - ' . $app->getCfg( 'sitename' ) ); ?> |
1 2 3 4 5 6 |
<?php $app = JFactory::getApplication(); $this->setTitle( $this->getTitle() . ' - ' . $app->getCfg( 'sitename' ) ); ?> |
1 2 3 4 5 6 7 8 9 10 11 |
<!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"> <head> <?php $app = JFactory::getApplication(); $this->setTitle( $this->getTitle() . ' - ' . $app->getCfg( 'sitename' ) ); ?> <jdoc:include type="head" /> .... rest of template file. |
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: Joomla, joomla tutorials