Reputation: 245
How to add different browser titles for different article pages?? also i needed help how to add different meta tags to different pages in joomla website...
Upvotes: 2
Views: 1189
Reputation: 3345
Setting custom page titles can be done by editing the menu item and entering the information in the "Browser Page Title" field under the "Page Display" tab.
The meta description and keyword hierarchy is: article, if not found then category, if not found then menu, if not found then global configuration.
Since you are customising the page titles, it is probably most convenient to enter your meta descriptions and keywords for each page under the "Metadata" tab while editing the menu option.
Upvotes: 0
Reputation: 815
Edit your article and you will see there are fields for you to enter meta description and keywords for your article. If you use Joomla! 3.x, they are in "Publishing" tab.
I don't really understand your "How to add different browser titles for different article pages??" question. If your article has a menu item, in the menu item setting there is an option to use your custom page title (for Joomla! 3.x, in Page Display tab -> Browser Page Title), by default this field is empty so your article title is used as page title. You can also enter meta description and keywords here however they are only used if your article doesn't have enter meta description and keywords.
Upvotes: 1
Reputation: 1681
Answering your first question:
You can try using the setTitle() function. Here is an example code on what I have used before:
$doc =& JFactory::getDocument();
$db = JFactory::getDBO();
$select="SELECT nombre ";
$from="FROM #__csglosario_terminos ";
$where="WHERE id=".$this->item->id;
$query=$select.$from.$where;
$db->setQuery($query);
$title=$db->loadResult();
$doc->setTitle("Glosario de turismo y hostelería - Término ".ucfirst($title)." - Diccionario de términos empleados en hoteles, restaurantes, agencias de viajes. Definiciones, usos, traducciones - Poraqui.net");
You can also check this out: http://docs.joomla.org/API15:JDocument/setTitle
Answering your second question:
You can try to use the setMetaData() function. Here is an example code on what I have used before:
$document= JFactory::getDocument();
$document->setMetadata('description', $this->metadescription);
$document->setMetadata('keywords', $this->metakeywords);
You can also check this out: http://docs.joomla.org/JDocument/setMetaData
Hope this helps :).
Upvotes: 0