Saturday, May 26, 2012

Joomla Title Tag Change

Page title tag <title> is important for search engine optimization of your website. Search engine crawlers will rank your website higher if your target keywords are in the <title> tag.

How to change <title> tag for a page of your Joomla site? When you edit a menu item, under System tab, you'll find Page Title. This will be <title> of the page, no matter if "Show Page Title" option is enabled or disabled.

However, what if you have 1000's of pages and you'd like to have word "ABC Widgets" on <title> tags of all your pages? You should edit your template. Open file index.php of your template (it's in "/templates/template_name" directory). After <head> add the following code:
<?php
$document =& JFactory::getDocument();
$document->setTitle($document->getTitle()." - ABC Widgets");
?>

After that, all pages will have <title> tag like: "Your page name - ABC Widgets". However, if default menu item (home page) of your site has title ABC Widgets, it will now become "ABC Widgets - ABC Widgets". This is something you probably don't want, so you can add conditional statements in order to disable altering of <title> tag for home page:
<?php
if (@$_REQUEST['view'] != 'frontpage') {
$document =& JFactory::getDocument();
$document->setTitle($document->getTitle()." - ABC Widgets");
}
?>

Finally, if you like word "ABC Widgets" to be before Joomla article title, the code should be like this:
<?php
if (@$_REQUEST['view'] != 'frontpage') {
$document =& JFactory::getDocument();
$document->setTitle("ABC Widgets - ".$document->getTitle());
}
?>

Different  Templates in different pages:
 

What if you wanted to save changes and publish them only on certain pages of your site? In this case, you can click Save as Copy button to create a new template style. Joomla will name it as "hot_templatename - Default (copy)". You can change template style's name if you need to. Now, you have one more style in the Template Manager. Click on the copied style's name and assign it to some pages of your site. In the Menus assignment block, you can see all your pages (menu items) listed. Select some of them and click Save & Close button.

joomla template stylesIn Joomla's Template Manager, you should have "hot_templatename - Default" with the star icon activated (yellow) in Default column (indicates it's default template for your site) and "hot_templatename - Default (copy)" with green tick icon in Assigned column (indicate this template style is assigned to some pages of your site). You can make more template styles. If you think that your visitors like colorful websites, using this method, you can assign different style for each page of your site.

SEO Master: Sukanto Saha

Odesk Hire Link: 
 

No comments: