tirenweb
tirenweb

Reputation: 31709

How to set titles for the web pages?

I have 2.5.6, how can I create a new web page with a new title? Now I have a navigation bar and the title of the pages correspond to the text in the items in the navigation bat, how can I create titles that are not the same as the items' content in the navigation bar? For exampe for the item "Home" the title of the page now is also "Home".

Upvotes: 0

Views: 678

Answers (3)

Victor York
Victor York

Reputation: 1681

ccpl's anwser is valid but that would be a static title. If you would like to have a dynamic title where it would change depending where you visit you will have to code it.

For example, if your site is a dictionary where you had the alphabet in the same menu the static title wouldn't ever change even if you chose any of those letters.

To make a dynamic title using code so it would change you should use this:

This is an example of a site that I'm developing where the title changes depending on the name you click on (the site is about terms & definitions).

$doc =& JFactory::getDocument();

$db = JFactory::getDBO();

$select="SELECT name";
$from="FROM #__csglosary_terms ";
$where="WHERE id=".$this->item->id;

$query=$select.$from.$where;

$db->setQuery($query);
$title=$db->loadResult();
$doc->setTitle("Glosary of terms and definitions - Term ".ucfirst($title)." - Dictionary of terms used in hotels, restaurants.");

The variable $title returns the term you have clicked on and will show up on the pages title.

Hopefully this helps you also :).

Upvotes: 0

Craig
Craig

Reputation: 9330

If you use the Help button in the toolbar for a menu item you'll find there is a section called "Page Display Options" the first field is called "Browser Page Title"

Joomla Menu Item — Page Display Option slider

The "Browser Page Title" is described as optional text for the "Browser page title" element. If left blank, the default value is used based on the Menu Item Title..

Upvotes: 1

Rahul Tripathi
Rahul Tripathi

Reputation: 172378

From the Forum

You can go to Global Config > Site > SEO Settings there is an option to include site name in page titles so you would then get "article title - site name" as your page title.

Upvotes: 0

Related Questions